[15810] in Perl-Users-Digest
Perl-Users Digest, Issue: 3223 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 31 18:10:39 2000
Date: Wed, 31 May 2000 15:10:28 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959811027-v9-i3223@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 31 May 2000 Volume: 9 Number: 3223
Today's topics:
Re: Help reading data from file (Abigail)
Re: Help reading data from file (Brandon Metcalf)
Re: Help reading data from file (Abigail)
Re: Help reading data from file <lr@hpl.hp.com>
Re: html retrieval and perl <flavell@mail.cern.ch>
Re: IPC::OPEN2 on NT yuri_leikind@my-deja.com
Re: Is my string already in an array? (David Wall)
Julian Days <campbell@coaps.fsu.edu>
Re: Julian Days (Mark Badolato)
Looking for clever code bumming (Clinton A. Pierce)
Re: Networking: STDOUT => network => STDIN (Alan Curry)
Newbies solves own problem!!! Buys "The Perl CD Bookshe <y-o-y@home.com>
Re: Newbies solves own problem!!! Buys "The Perl CD Boo squidrocks@my-deja.com
Re: Newbies solves own problem!!! Buys "The Perl CD Boo <y-o-y@home.com>
Oracle 8.1, Perl 5.05, DBI on Solaris 2.6 <MarkHeaton@email.msn.com>
Re: Pattern Matching question <care227@attglobal.net>
Re: Pattern Matching question squidrocks@my-deja.com
Re: Pattern Matching question <dwhaskin@earthlink.net>
Re: perl and nanosleep()? <jerrad@networkengines.com>
Re: Perl error reporting? <abe@ztreet.demon.nl>
Perl in Russia terescschenko@my-deja.com
Perl in Russia tereschenko@bigfoot.com
PERL JOBS (£40k+) <Mail@Web-Recruit.co.uk>
Re: Perl unusable as a programming language (Bart Lateur)
Re: Perl unusable as a programming language <kaleja@estarcion.com>
perlcc - compile .pm to .so and use keith53@my-deja.com
Perlscript ASP Session Objs in windows 2000 slayt0r@my-deja.com
Re: Question about LWP::UserAgent? <dwhaskin@earthlink.net>
Re: Reference Sorting <abe@ztreet.demon.nl>
Re: Reference Sorting <abe@ztreet.demon.nl>
Re: REQ:Tripod.com perl module include help (Bart Lateur)
Retrieving an Entry Within a File <tclarke@dti.net>
routine to build web page with expand/collapse subheads <richard.crane@yale.edu>
Re: Secure (enough) dayta encryption and decryption <luisr@juanadiaz.org>
Re: Secure (enough) dayta encryption and decryption <luisr@juanadiaz.org>
Re: Secure (enough) dayta encryption and decryption <luisr@juanadiaz.org>
Re: Strategies for determining if there's a memory leak <dwhaskin@earthlink.net>
Re: The Adventure of CPAN (Elaine -HFB- Ashton)
Re: use File::Find <bobmerrill@my-deja.com>
Re: use File::Find <lr@hpl.hp.com>
Visual Perl ? Required ? <samay1NOsaSPAM@hotmail.com.invalid>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 May 2000 18:08:59 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Help reading data from file
Message-Id: <8h3kfr$s6r$1@news.panix.com>
On Wed, 31 May 2000 09:21:10 -0400, Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
++
++ If you want unique words:
++
++ perl -ne '$h{$_}++for split;END{print join("\n",keys%h)}'
Golf:
perl -nale '@F{@F}=()}{print for keys%F'
And if 0 cannot appear as a word, you can do one stroke better:
perl -nale '@F{@F}=()}{map$_&&print,%F'
Abigail
------------------------------
Date: 31 May 2000 20:40:06 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: Help reading data from file
Message-Id: <8h3tb6$h0p$1@spinner.corpeast.baynetworks.com>
abigail@arena-i.com writes:
> Golf:
>
> perl -nale '@F{@F}=()}{print for keys%F'
>
> And if 0 cannot appear as a word, you can do one stroke better:
>
> perl -nale '@F{@F}=()}{map$_&&print,%F'
Can someone explain the }{ syntax?
Brandon
------------------------------
Date: 31 May 2000 21:13:31 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Help reading data from file
Message-Id: <8h3v9r$2su$1@news.panix.com>
On 31 May 2000 20:40:06 GMT, Brandon Metcalf <bmetcalf@baynetworks.com> wrote:
++ abigail@arena-i.com writes:
++
++ > Golf:
++ >
++ > perl -nale '@F{@F}=()}{print for keys%F'
++ >
++ > And if 0 cannot appear as a word, you can do one stroke better:
++ >
++ > perl -nale '@F{@F}=()}{map$_&&print,%F'
++
++ Can someone explain the }{ syntax?
It's the closing bracket of a block, followed by an opening bracket of
another block. See man perlrun, and don't look for any hidden meaning
when it describes -n. Just fill in the dots where it says 'your
program goes here'. Don't change more than the dots.
Abigail
------------------------------
Date: Wed, 31 May 2000 14:07:16 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Help reading data from file
Message-Id: <MPG.139f1ee1c105dcf698ab10@nntp.hpl.hp.com>
In article <8h3tb6$h0p$1@spinner.corpeast.baynetworks.com> on 31 May
2000 20:40:06 GMT, Brandon Metcalf <bmetcalf@baynetworks.com> says...
> abigail@arena-i.com writes:
>
> > Golf:
> >
> > perl -nale '@F{@F}=()}{print for keys%F'
> >
> > And if 0 cannot appear as a word, you can do one stroke better:
> >
> > perl -nale '@F{@F}=()}{map$_&&print,%F'
>
> Can someone explain the }{ syntax?
It isn't Perl 'syntax' per se. It is a trick. To understand it, look
in perlrun under the '-e' switch, and realize that the Perl code
described by the string following the '-e' flag is substituted
*literally* where indicated there.
Abigail has shown us this trick before, most notably in answer to the
'print the number of lines in a file' question.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 31 May 2000 20:44:27 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: html retrieval and perl
Message-Id: <Pine.GHP.4.21.0005312041260.21492-100000@hpplus01.cern.ch>
On Wed, 31 May 2000, Denis Haskin wrote:
> perl -MLWP::Simple -e "print get('http://www.yahoo.com')"
> it works as expected, and I get the raw seething HTML of Yahoo.
^^^^^^^^^^^^^^^^^
Many a true word spoken in jest!
------------------------------
Date: Wed, 31 May 2000 17:58:27 GMT
From: yuri_leikind@my-deja.com
Subject: Re: IPC::OPEN2 on NT
Message-Id: <8h3jrt$i3a$1@nnrp1.deja.com>
In article <MPG.139edb73a855e0719896f6@news>,
elephant@squirrelgroup.com (jason) wrote:
> yuri_leikind@my-deja.com writes ..
> >Using IPC::Open2 on NT (which has become possible only with $|=1 ) I start in
> >my script a program as a function which receives a line in stdin and gives a
> >line to stdout.
> >
> >The problem is after closing both filehandles the process is
> >left in memory and is not finished.
> >
> >Using this program from CMD I stop it by pressing CTRL-Z.
> >How do I emulate this in my script if
> >close FH1; close FH2;
> >doesn't help?
>
> I've successfully used Open2 on NT .. perhaps you could post the
> relevant code (hopefully showing the application you're trying to
> interact with)
>
> --
> jason - elephant@squirrelgroup.com -
Oh, thanks a lot for your readinnes to help, but... well..
it's me to blame. The problem was in that executable...
I've solved the problem, thanks.
ActiveState is not bad after all ;-))
Yuri Leikind
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 31 May 2000 15:32:14 -0400
From: darkon@one.net (David Wall)
Subject: Re: Is my string already in an array?
Message-Id: <8F45954BDdarkononenet@206.112.192.118>
royNOroSPAM@england.com.invalid (Roy) wrote in
<179d3b40.96e427e2@usw-ex0105-037.remarq.com>:
>I'm looking for the best way to check if the value of my string
>is equal to any of the elements in an array. I can think of a
>couple of ways of doing this, by individually checking each
>element against the string, or by join-ing the array into a big
>string and searching for the target string using index. However
>both of these seem a little cumbersome. Is there a more
>efficient way I'm missing?
Look in perlfaq4 for "How can I tell whether a list or array contains a
certain element?"
--
David Wall
darkon@one.net
------------------------------
Date: Wed, 31 May 2000 17:31:34 -0400
From: Stacey Campbell <campbell@coaps.fsu.edu>
Subject: Julian Days
Message-Id: <393584B6.F896537B@coaps.fsu.edu>
Does anyone have a routine for determining the Julian Day/
day_of_the_year?
You see, localtime(time) gives 100 as the year (99 + 1), which must be
modified to 2000 in order to determine if it's a leap year. You have to
determine if it is a leap year, because if it is, you have to then add 1
to the yday that localtime(time) returns.
So you see, localtime(time) is not very efficient. Because of these
problems, I'm worried about depending on localtime() to create my Julian
Day file names automatically here at work. It could screw up data
retrieval, file creation, and in general, data could be lost or written
over.
-Stacey Campbell-
campbell@coaps.fsu.edu
------------------------------
Date: 31 May 2000 21:55:44 GMT
From: mbadolato@quepasa.com (Mark Badolato)
Subject: Re: Julian Days
Message-Id: <8F459AF65mbadolatoquepasacom@206.165.3.80>
[posted and mailed]
campbell@coaps.fsu.edu (Stacey Campbell) wrote in
<393584B6.F896537B@coaps.fsu.edu>:
>Does anyone have a routine for determining the Julian Day/
>day_of_the_year?
Aside from the one in the Time::JulianDay module?
>You see, localtime(time) gives 100 as the year (99 + 1), which must
No, localtime returns the number of years since 1900. Read the docs.
perldoc -f localtime
--Mark
------------------------------
Date: Wed, 31 May 2000 21:49:48 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Looking for clever code bumming
Message-Id: <0OfZ4.96182$h01.690102@news1.rdc1.mi.home.com>
I've been staring at this construct in one of my programs for about
half an hour now, thinking to myself:
"Gee, there's a lot of almost-duplicated code in there. I wonder
if I can make it just a little bit shorter."
and gotten myself into a funk. Here's the code, unobfuscated:
if ($_) {
$string.= $p->{grid}->[$sx]->[$sy];
push(@coord, [ $sx, $sy ]) ;
} else {
$string.=$p->{grid}->[$sy]->[$sx];
push(@coord, [ $sy, $sx ]);
}
Notice that the only difference is that sx and sy are reversed in
the two cases. Any ideas how to tighten that up? Obfuscation is
fine. There has to be a clever way to do this. :)
If this one isn't your speed, I have another "gee, there's gotta be
a better way" in that program...but that's for another posting. :)
BTW: Don't change the structures themselves...I need them for a lot
of other things going on in the loop that contains this.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Wed, 31 May 2000 20:46:53 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Networking: STDOUT => network => STDIN
Message-Id: <1TeZ4.150388$681.2725426@news-east.usenetserver.com>
In article <39351970.90EFE59C@usgs.gov>,
William H. Asquith <wasquith@usgs.gov> wrote:
>I require something like this:
>% server_program -stdout file2process.txt | networking_server_script |
>networking_client_script | client_program -stdin
Does this look familiar:
$ tar cf - somedir | rsh otherhost tar xf -
Solaris probably comes with rsh, and the server should be in /etc/inetd.conf
You might want to use ssh instead. It adds encryption and some other cool
features over the original rsh. See openssh.com
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Wed, 31 May 2000 19:09:12 GMT
From: Andy <y-o-y@home.com>
Subject: Newbies solves own problem!!! Buys "The Perl CD Bookshelf".
Message-Id: <srdZ4.225820$Tn4.1980945@news1.rdc2.pa.home.com>
That's my solution anyway. Only $60. Money well spent. Right up front,
thanks to the authors and publisher O'Reilly!!!
The books were micro-typed, IMHO. Now I can search, copy code snippets
and most importantly, read with MY typeface with comfortable type sizes
and a comfortable column width!!! With four monitors, it shouldn't
present a desktop real-estate problem.
I'll be gone for awhile I think. ;-)
Six best selling books on CD-ROM. Are computers great or what???
RTFM? yep!!!
Best regards,
Andy
------------------------------
Date: Wed, 31 May 2000 19:26:47 GMT
From: squidrocks@my-deja.com
Subject: Re: Newbies solves own problem!!! Buys "The Perl CD Bookshelf".
Message-Id: <39356703.101333288@news.it.gvsu.edu>
On Wed, 31 May 2000 19:09:12 GMT, Andy <y-o-y@home.com> wrote:
>That's my solution anyway. Only $60. Money well spent. Right up front,
>thanks to the authors and publisher O'Reilly!!!
>
>The books were micro-typed, IMHO. Now I can search, copy code snippets
>and most importantly, read with MY typeface with comfortable type sizes
>and a comfortable column width!!! With four monitors, it shouldn't
>present a desktop real-estate problem.
>
>I'll be gone for awhile I think. ;-)
>
>Six best selling books on CD-ROM. Are computers great or what???
>
>RTFM? yep!!!
>
>Best regards,
>
>Andy
My version came with a bonus book, Perl in a Nutshell...although I
still haven't figured out how to solve my own problems.
------------------------------
Date: Wed, 31 May 2000 20:48:29 GMT
From: Andy <y-o-y@home.com>
Subject: Re: Newbies solves own problem!!! Buys "The Perl CD Bookshelf".
Message-Id: <xUeZ4.225860$Tn4.1982120@news1.rdc2.pa.home.com>
In article <39356703.101333288@news.it.gvsu.edu>,
squidrocks@my-deja.com wrote:
squidrocks,
<snip>
> My version came with a bonus book, Perl in a Nutshell...although I
> still haven't figured out how to solve my own problems
It did come with the Nutshell quick reference.book. I went straight to
the CD "Learning Perl, Edition 2" book(?) first. I'm too new to continue
with bad programming habits carried over from other languages.
I'll probably "HEAR YE, HEAR YE" post to this ng after some blind flash
of comprehension has occurred, if allowed.
Best regards,
Andy
------------------------------
Date: Wed, 31 May 2000 19:17:52 +0100
From: "Mark Heaton" <MarkHeaton@email.msn.com>
Subject: Oracle 8.1, Perl 5.05, DBI on Solaris 2.6
Message-Id: <OZuyC3yy$GA.188@cpmsnbbsa09>
I have installed all the above and when we try to make a DBI call via Perl's
DBI library an error occurs saying a Solaris patch is required for the Java
Runtime Environment (1.1.10 and 1.1.8 both have the same result).
From digging through Sun's website and elsewhere it is clear that Solaris
2.5.1 needs a patch applied to support native threads. However this is not
needed for 2.6.
Has anyone come accross this and been able to resolve this. The error is
most likely in the Perl DBI lib but Oracle does not help with its errors.
Regards
Mark
------------------------------
Date: Wed, 31 May 2000 14:21:26 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Pattern Matching question
Message-Id: <39355826.E8716A0@attglobal.net>
squidrocks@my-deja.com wrote:
>
> I'm writing a program that utilizes wgrep to retrieve a website then, in
> perl, pattern match to find the correct file to be downloaded. The link
Why aren't you just using Perls built in pattern matching?
------------------------------
Date: Wed, 31 May 2000 18:41:41 GMT
From: squidrocks@my-deja.com
Subject: Re: Pattern Matching question
Message-Id: <39355cc3.98708570@news.it.gvsu.edu>
On Wed, 31 May 2000 14:21:26 -0400, Drew Simonis
<care227@attglobal.net> wrote:
>squidrocks@my-deja.com wrote:
>>
>> I'm writing a program that utilizes wgrep to retrieve a website then, in
>> perl, pattern match to find the correct file to be downloaded. The link
>
>Why aren't you just using Perls built in pattern matching?
I don't know how.
------------------------------
Date: Wed, 31 May 2000 19:19:35 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: Pattern Matching question
Message-Id: <39356532.C7CA8BE@earthlink.net>
squidrocks@my-deja.com wrote:
> On Wed, 31 May 2000 14:21:26 -0400, Drew Simonis
> <care227@attglobal.net> wrote:
>
> >squidrocks@my-deja.com wrote:
> >>
> >> I'm writing a program that utilizes wgrep to retrieve a website then, in
> >> perl, pattern match to find the correct file to be downloaded. The link
> >
> >Why aren't you just using Perls built in pattern matching?
>
> I don't know how.
That's sort of like using a hammer to drive a screw (or some other pithy
analogy).
If you're going to use perl, learn it and use it. This does what you want to
do, methinks:
use LWP::Simple;
$page = get('http://www.nai.com/asp_set/download/dats/mcafee_4x.asp');
($href) = $page =~ m|href="(.+superdat/english/nai/intel.+)"|;
print $href, "\n";
dwh
------------------------------
Date: Wed, 31 May 2000 16:30:10 -0400
From: jerrad pierce <jerrad@networkengines.com>
Subject: Re: perl and nanosleep()?
Message-Id: <39357652.ADA284AD@networkengines.com>
select(undef,undef,undef,.0001);
There does not appear to be any documented level of granularity
try perldoc -f select
and read about the 4 arg version
------------------------------
Date: Thu, 01 Jun 2000 00:19:48 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Perl error reporting?
Message-Id: <ih3bjsssi6hnqc3k5dlmqiui6l2uk6p76h@4ax.com>
On Wed, 31 May 2000 13:25:13 GMT, ajmayo@my-deja.com wrote:
[snip]
> When we talk about autogenerated code we come to the nub of the
> problem. If the code is eval'd at runtime (e.g by mod_perl) how do you
> propose making it easier to track problems. Is there some technique
> that would help here - in which case I will go and use it, and quit
> whining - or do we have a genuine problem here?.
I don't know about mod_perl, but you could try something like:
sub my_eval {
my $code = shift;
my @result = do {
local @ARGV = @_;
eval($code);
};
return wantarray? @result : $result[0] unless $@;
local $" = q!', '!;
die <<"EOERROR";
An error occurred: ('@_')
------------------------------
$code
------------------------------
$@
EOERROR
}
--
Good luck,
Abe
------------------------------
Date: Wed, 31 May 2000 19:08:34 GMT
From: terescschenko@my-deja.com
Subject: Perl in Russia
Message-Id: <8h3nvb$kt5$1@nnrp1.deja.com>
A group of Russian programmers lead by Alexander S. Tereschenko (that's
me) announced that it will going to translate most of free available
document about Perl into Russian, plus plans to open first Russian Perl
training in September 2000.
The only problem is that we are cannot contact anyone at Perl.com,
O`REILLY or PerlPorters, bacause of our mails recognized as "spam
domains".
Hope this message will help, because we need to discuss some important
question about licensing, copyrights and Perl sources.
Thank you. Sincerely your, Alexander S. Tereschenko
Contact me at: tereschenko@bigfoot.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 19:56:06 GMT
From: tereschenko@bigfoot.com
Subject: Perl in Russia
Message-Id: <8h3qog$mm9$1@nnrp1.deja.com>
A group of Russian programmers lead by Alexander S. Tereschenko (that's
me) announced that it will going to translate most of free available
document about Perl into Russian, plus plans to open first Russian Perl
training in September 2000.
The only problem is that we are cannot contact anyone at Perl.com,
O`REILLY or PerlPorters, bacause of our mails recognized as "spam
domains".
Hope this message will help, because we need to discuss some important
question about licensing, copyrights and Perl sources.
Thank you.
Sincerely your, Alexander S. Tereschenko
Contact me at: tereschenko@bigfoot.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 20:27:07 +0100
From: "Ben Hobbs" <Mail@Web-Recruit.co.uk>
Subject: PERL JOBS (£40k+)
Message-Id: <8h3p61$efu$1@plutonium.btinternet.com>
Web-Recruit specialise in Internet Jobs for Perl, Apache and UNIX positions.
We are currently seeking PERL / UNIX Developers for positions in London
(mainly). These positions will pay a minimum of £40,000 + excellent bonuses,
share options, health and pension plans....
Please email Perl@web-recruit.co.uk or call 01908 269898 to speak to Ben
Hobbs.
Regards
Ben Hobbs
------------------------------
Date: Wed, 31 May 2000 18:15:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl unusable as a programming language
Message-Id: <39355518.328067@news.skynet.be>
Simon Cozens wrote:
>Will you *please*, for the love of God and all the saints, stop
>spreading the malicious and misleading untruth that Perl is
>non-deterministic.
But it is. Er,... in a way. I can see Ilya's point. Perl's behaviour may
be deterministic, but there are always (deterministcic) exceptions to
the general rules. Unfortunately, not all exceptions are sufficiently
documented, for example the split /^/ thing. You can't derive the
behaviour for 100% from the docs, therefore, your might just as well
consider Perl's behaviour to be non-deterministic for those cases.
And I can see Ilya's other point too: if Perl's behaviour isn't
completely formalized, it is also impossible to prove, in the general
case, that a Perl program is correct.
Therefore, you have to determine the behaviour by experimentation, which
is good enough for "scripting" (in Ilya's terms), but not for
"programming" (same). Don't bet your life, literally, that a program
will always work correctly. Perl for life-critical applications is out.
OTOH I would rather trust my life on a Perl script than on something
running on Windows. :-)
--
Bart.
------------------------------
Date: Wed, 31 May 2000 13:31:04 -0700
From: Russell Bornschlegel <kaleja@estarcion.com>
Subject: Re: Perl unusable as a programming language
Message-Id: <39357688.FF5B7D4A@estarcion.com>
Bart Lateur wrote:
> You can't derive the
> behaviour for 100% from the docs, therefore, your might just as well
> consider Perl's behaviour to be non-deterministic for those cases.
Nope, because Perl should do the same thing with a given construct
every single time, and you can determine the behavior by experiment
or by RTFS.
> And I can see Ilya's other point too: if Perl's behaviour isn't
> completely formalized, it is also impossible to prove, in the general
> case, that a Perl program is correct.
It's impossible to prove in the general case that any real-world program
in _any_ language is "correct" in the sense that it will _execute_ as
intended, given buggy interpreters, compilers, OSes, and hardware.
Yes, I'm aware that Computer Science has a different definition of
"proving a program correct" than I'm using.
> OTOH I would rather trust my life on a Perl script than on something
> running on Windows. :-)
How about a Perl script running on Windows?
-Russell B
------------------------------
Date: Wed, 31 May 2000 20:37:10 GMT
From: keith53@my-deja.com
Subject: perlcc - compile .pm to .so and use
Message-Id: <8h3t5l$og3$1@nnrp1.deja.com>
The perlcc documentation says you can compile a module (a .pm file)
into a shared object (a .so file) that can be included in a Perl
program via use. I was able to compile the .so but cannot figure out
how to include it in another perl program via use. I have tried
several ways. Documentation for the use statement says it only accepts
module names. If I use a file.so it says it can't locate file.pm. If
I change my .so into a .pm I get the error Unrecognized character \177
at ... yet the module has compiled sucessfully, is syntatically
correct -> If I try to use the original .pm it works fine. I get the
same error if I require the .so file.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 18:27:34 GMT
From: slayt0r@my-deja.com
Subject: Perlscript ASP Session Objs in windows 2000
Message-Id: <8h3li8$j95$1@nnrp1.deja.com>
I'm having issues with PS 522 (note, not 5.6) writing ASP session
objects in Windows 2000.
Let's say I have the following code:
<CodeSnippet>
$FirstName = "Fred";
$LastName = "Smith";
$Session->Contents->SetProperty('Item', "FName", $FirstName);
$Session->Contents->SetProperty('Item', "LName", $LastName);
print "-".$Session->{"FName"}."-<br>";
print "-".$Session->{"LName"}."-<br>";
</CodeSnippet>
in NT4, the output is:
-Fred-
-Smith-
in Win2000, the output is:
--
--
Anyone have any insight?
thanks,
AC Slayt0r
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 18:07:04 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: Question about LWP::UserAgent?
Message-Id: <39355439.A7450443@earthlink.net>
rddliu@ms1.hinet.net wrote:
> Dear all:
> I want to simulate a browser.So I use the LWP::UserAgent module.
> But this module only can simulate
> 1. User-Agent : like Mozilla/4.0 ...
> 2. Content-type : application/x-www-form-urlencoded
>
> The question here is that" Can I simulate more ? "
> Like
> 1. Accept: application/msword ,...
> 2. Accept-Language : en-us
> 3. Some or every variables in $ENV{$key}
Sure. LWP::UserAgent::request() takes as a parameter an HTTP::Request
object. So if you look at the doc for HTTP::Request, you'll see you have
full access to modifying, adding, and removing headers.
dwh
------------------------------
Date: Wed, 31 May 2000 22:35:47 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Reference Sorting
Message-Id: <c1sajsk6aha1lgs9muk2pfm7m177fij5o6@4ax.com>
On Wed, 31 May 2000 11:35:13 -0500, "spurcell" <skpurcell@hotmail.com>
wrote:
> Hello,
Hi,
> I am working with references and need to do a sort on a array of hashes.
perldoc -f sort
perldoc perldsc
>
> Here is what I have done.
I doubt that, it won't compile. Please use 'copy/paste' if you want to
show code.
> # so now I am trying to sort against the 'name' key of the array reference.
>
> @names = sort { lc{$a->{'name'} cmp lc{$b->{'name'})) @{$class};
^ ^ ^^
That is a mess. Make sure you use the '-w' flag and 'use strict;' to let
perl help you find mistakes. Although this is a plain syntax error.
my @names = sort { lc $a->{name} cmp lc $b->{name} } @$class;
> # but that sort does not work This is where I need a hand.
> # because when I print it, it is not worted.
> foreach $x(@{$names}) {
^^^^^^
You have just put the results of sort into an array (@names) and you
have not assigned anything to $names. I am surprised you even get
output.
Again help yourself by putting 'use strict;' at the top of your program
and turning on warnings (-w).
> print "$x->{'name'}
> }
>
> # I get
You can't with the code you've shown here.
This might give you the sorted list:
#!/usr/bin/perl -w
use strict;
my $class = [
{ id => 1, name => 'cars' },
{ id => 2, name => 'trucks' },
{ id => 3, name => 'trains' },
{ id => 4, name => 'tractors' },
];
my $names = [ sort { lc $a->{name} cmp lc $b->{name} } @$class ];
print map { "$_->{id} - $_->{name}\n" } @$names;
__END__
--
Good luck,
Abe
------------------------------
Date: Wed, 31 May 2000 22:36:00 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Reference Sorting
Message-Id: <ukqajscagma709im5vj3enevtegvchdcuq@4ax.com>
On Wed, 31 May 2000 10:32:24 -0700, Makarand Kulkarni
<makarand_kulkarni@My-Deja.com> wrote:
> > (Which is not in a sorted list?)
>
> $class1->{'id'} = 1;
> $class1->{'name'} = 'p';
> $class2->{'id'} = 2;
> $class2->{'name'} = 'a';
> $class3->{'id'} = 3;
> $class3->{'name'} = 'x';
> $class4->{'id'} = 4;
> $class4->{'name'} = 'w';
> push @classes, $class1;
> push @classes, $class2;
> push @classes, $class3;
> push @classes, $class4;
> $class = \@classes;
If OP is going to pass the referece around, why bother with all the
variables? (see my other post)
>
> @names = sort { $a cmp $b } map { $_->{name} } @{$class};
^^^^^^^^^^^^^
That is the default sort-sub, and sort is much faster without it. This
doesn't lc() the 'name'-field. And of course it only returns the sorted
list of 'name'-fields and not the rest of the data.
>
> print join(" ",@names), "\n";
--
Good luck,
Abe
------------------------------
Date: Wed, 31 May 2000 21:09:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: REQ:Tripod.com perl module include help
Message-Id: <39367808.956299@news.skynet.be>
Derek D'Angelo wrote:
>I've been trying to include both a tripod module, TripodPage, and CGI.pm
>
>I've used..
>
>require TripodPage;
>use TripodPage;
>
>neither have worked.
I hope the file was saved as "TripodPage.pm". Because ".pm" is the
default extension.
--
Bart.
------------------------------
Date: Wed, 31 May 2000 14:31:54 -0400
From: Elsied <tclarke@dti.net>
Subject: Retrieving an Entry Within a File
Message-Id: <MPG.139f24a68ea4317f989682@News.CIS.DFN.DE>
Hi all.
I'm having a problem with the following piece of code:
$device = $ARGV[0];
open (LIST, 'e:\list.txt');
while (<LIST>) { chomp($_);
if ($device eq $_) {
$mail{To} = 'pager@domain.com'; } else { if ($device ne $_) {$mail{To} =
'email@domain.com'; }
...send message via mail::sendmail...
The way this works is it will try to find instances of $device in a text
file and change $mail{To} either a pager if it finds or an email address
if it does not. The problem is it searches every entry in the file and
changes the variable for every entry. If $device is number 5 of 6
entries in "list.txt" it will change go to mail rather than page because
the 6th entry does not match. This might be more of a general newby Perl
question: How can I match an entry and disregard the ones that do not in
a file? There would be over a thousand entries in the txt file.
Definetly not looking for code, just a point in the right direction.
Thanx
------------------------------
Date: Wed, 31 May 2000 16:44:23 -0400
From: Richard Crane <richard.crane@yale.edu>
Subject: routine to build web page with expand/collapse subheads
Message-Id: <393579A7.ADB470E3@yale.edu>
This is a multi-part message in MIME format.
--------------17DBF90C36BF5A455F46AFFE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ran across a site just a few days ago documenting a package to show an
outline with expanding/collapsing subheads a few days ago, and now the
link escapes me. Pointers to any such tools appreciated.
TIA --
--------------17DBF90C36BF5A455F46AFFE
Content-Type: text/x-vcard; charset=us-ascii;
name="richard.crane.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Richard Crane
Content-Disposition: attachment;
filename="richard.crane.vcf"
begin:vcard
n:Crane;Richard
tel;fax:(203) 432-0593
tel;work:(203) 432-1256
x-mozilla-html:FALSE
org:Yale University;Workstation Support Services
version:2.1
email;internet:richard.crane@yale.edu
title:Staff Specialist
adr;quoted-printable:;;Arthur K.Watson Hall, Room 015=0D=0A51 Prospect Street;New Haven ;CT;06520;USA
fn:Richard Crane
end:vcard
--------------17DBF90C36BF5A455F46AFFE--
------------------------------
Date: Wed, 31 May 2000 14:15:05 -0300
From: "Luis E. Rodriguez" <luisr@juanadiaz.org>
Subject: Re: Secure (enough) dayta encryption and decryption
Message-Id: <sjalnr9h5pj27@corp.supernews.com>
Dave Winfred wrote in message ...
>>I am looking for a reasonably secure way to store encrytped data so
>HAHAHAHAAAAAA!!! ROTFLMAO!!!
>
>Nothing personal, but that's hilarious. Encrypted data that your can't
>decode isn't of any value...except in tales from the crypt.
For what is worth, I said that because there is a way to encrypt data in
Perl but does not decrypt.
>PGP is the most common encryption method and widely available. There are
>some modules in CPAN that do the GNU PGP implementation. There are also
>modules that use other encryption methods. However, PGP is your best
>choice if you plan to move the encrypted data off the server -
>especially if the server and the other machine are not the same
>platform; for example, a DEC ALPHA server and a Win9x platform as the
>other machine. The reason for this is that PGP is available for many
>platforms. Other encryption methods are not as widely supported on
>multiple platforms.
The data will reside at the web server at all times and the site runs at a
web hosting company. What I have in mind is to have the site operator
provide the key whenever decryption is needed. That is, keep the key out of
the web server. The transactions are not going to ocurr in real time, at
least not for the time being. They are going to be handled in batch form.
I thought about PGP but I was not sure if there was a Perl implementation
available.
Thanks for the information.
------------------------------
Date: Wed, 31 May 2000 14:17:12 -0300
From: "Luis E. Rodriguez" <luisr@juanadiaz.org>
Subject: Re: Secure (enough) dayta encryption and decryption
Message-Id: <sjalrqno5pj154@corp.supernews.com>
jason wrote in message ...
>>HAHAHAHAAAAAA!!! ROTFLMAO!!!
>>
>>Nothing personal, but that's hilarious. Encrypted data that your can't
>>decode isn't of any value...except in tales from the crypt.
>
>oh how wrong you are .. credit card numbers are a perfect example of
>where a one-way encryption algorithm is useful
The remark looked out of place for me because I use one-way encryption a lot
for password protection. But I didn't think it was worth explaining.
------------------------------
Date: Wed, 31 May 2000 14:25:06 -0300
From: "Luis E. Rodriguez" <luisr@juanadiaz.org>
Subject: Re: Secure (enough) dayta encryption and decryption
Message-Id: <sjamaj9j5pj77@corp.supernews.com>
jason wrote in message ...
>Luis E. Rodriguez writes ..
>you're much better off asking this question elsewhere .. as the one
>response that I can see so far demonstrates -> this is the wrong
>newsgroup entirely to seek advice on encryption methods
I have noticed that there are many posters that enjoy criticizing or
questioning other posters' messages. But I do come back regularly because
among the noise I will always find good answers and advice to my questions.
>(but hint: 90% of credit card number encryption for the purpose of
>storing the numbers should be done using one-way algorithms)
Problem is that transactions are going to be handled in batch form (as in
monthly billing) and users will provide their card number once and then when
billing time arrives the number is used for billing the customers, all of
them in one operation and without customer intervention. One-way encryption
won't work. I might be mistaken but the way I see it, one-way encryption
only works for authentication purposes.
>if you really do need a two-way algorithm - once you've worked out what
>encryption algorithm you want to use go to CPAN (www.cpan.org) and
>search for the algorithm name in the modules list .. most common
>algorithms have excellent modules with simple interfaces
Thanks for the information. Will go check that.
------------------------------
Date: Wed, 31 May 2000 15:50:55 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: Strategies for determining if there's a memory leak?
Message-Id: <39353450.BF8A8FEA@earthlink.net>
Matt Sergeant wrote:
> Denis Haskin wrote:
> >
> > use XML::DOM;
>
> My tip is to watch that you are freeing the circular references created by
> this package...
>
Yes, I was originally missing the calls to XML::DOM::dispose(), which I have
added (it's not clear it had any effect, though).
I'm pretty much taking the same approach you described... print() statements
all over the place. Actually, since I had a pretty good centralized logging
module already in place, it was quite easy to add code there to look at
process resources, and then liberally sprinkle logfile->log() calls all over
the place.
Right now I'm mainly suspecting MLDBM and GDBM and a lot tying & untying of a
db that I'm doing. I'm going to switch (back) to DB_File and use one of the
locking modules (probably Tie::DB_FileLock) so that I can just tie() the db
once.
I've thought about BerkeleyDB as well but the current version won't build on
my system (Solaris 2.6, Perl 5.6).
If I can get the leakage down to something reasonable I'm willing to live with
it for now; each server instance only lives for a limited time.
Much thanks,
dwh
------------------------------
Date: 31 May 2000 21:22:22 GMT
From: elaine@chaos.wustl.edu (Elaine -HFB- Ashton)
Subject: Re: The Adventure of CPAN
Message-Id: <slrn8jb0hm.2iq.elaine@chaos.wustl.edu>
In article <8h362h$88g$1@nnrp1.deja.com>, webqueen, queen of the web wrote:
>
>The thing is we I.S. pro's are TRYING to be productive aren't we? Its
>NOT productive to spend 2 hours exploring CPAN and NEWS only to discover
>that Net::ftp links to a directory that doesn't contain it. Nor is it
>productive signing up to an email userlist to get modules or module
>information.
Did you try WAIT or http://search.cpan.org/ ? Both are listed on the
CPAN pages.
e.g. http://search.cpan.org/search?dist=libnet
'perl -MCPAN -e shell' will also find this module and install it for
you if it isn't installed already.
>I tried to volunteer previously to help with modules- and received
>no reply [1]. I was told by others here in this newsgroup that those
>responsibilities are given to gurus and more senior Perl community
>members. So my attempt to be part of the solution didn't work either.
What sort of help did you volunteer? I don't think anyone is turned away
if they have a good idea or are willing to work on projects.
>I can't volunteer now with my other responsibilities, but I'd still like
>to understand why this is all so difficult. The time lost in people
>searching for Net::ftp alone HAS to be 1000x the time it would have
>taken to proper link and document it.
Well..what sorts of 'proper links' would you like to see? Currently there
are about 15 different ways to find it and how people look for things is
of some interest.
e.
>[1] - as a sidebar, I also sent module abstracts to the repository folks
>who were in TPJ several issues ago. Repeated emails didn't get me
>anywhere with them - not even an automated reply. So I've also tried to
>contribute software to the community with no results either. The Perl
>Community seems like a club that ordinary people can't join. At least it
>seems that way.
Abstracts for modules go to modules@cpan.org. If noone replies it means
there is nothing anyone behind that alias feels like contributing. You
get a PAUSE ID and you submit your module.
The Perl community does, at times, seem like a club but think of it this
way; If you have something to contribute, do it and if it's good people
will notice...you don't need to sit around waiting for someone to tell
you it's 'OK' to go ahead and do your own thing as certainly none of
them did.
e.
------------------------------
Date: Wed, 31 May 2000 18:27:43 GMT
From: Dr. Bob <bobmerrill@my-deja.com>
Subject: Re: use File::Find
Message-Id: <8h3lih$j96$1@nnrp1.deja.com>
> > open INP, "$tmpfil" || die "cannot open tmpfil\n";
> > open OUT, ">$file" || die "cannot re-open $file\n";
> You should use 'or' instead of ||. See "perldoc perlop". || has a
higher
> precedence. In the code above, you won't catch any error from rename
and
> open. You are really evaluating this:
> open OUT, (">$file" || die "cannot re-open $file\n");
Damn, learn something new everyday. Has this always worked this way
(including Perl4?).
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 12:17:57 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: use File::Find
Message-Id: <MPG.139f053fb5dfa8d398ab0e@nntp.hpl.hp.com>
In article <8h3lih$j96$1@nnrp1.deja.com> on Wed, 31 May 2000 18:27:43
GMT, Dr. Bob <bobmerrill@my-deja.com> says...
> > > open INP, "$tmpfil" || die "cannot open tmpfil\n";
> > > open OUT, ">$file" || die "cannot re-open $file\n";
> > You should use 'or' instead of ||. See "perldoc perlop". || has a
> > higher precedence. In the code above, you won't catch any error
> > from rename and open. You are really evaluating this:
> > open OUT, (">$file" || die "cannot re-open $file\n");
>
> Damn, learn something new everyday. Has this always worked this way
> (including Perl4?).
Yes.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 31 May 2000 11:36:33 -0700
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: Visual Perl ? Required ?
Message-Id: <083949dc.61282365@usw-ex0104-031.remarq.com>
Coming from ActiveState..
Follow the link
http://www.activestate.com/Corporate/Media_Center/News/Press95911
7519.html
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3223
**************************************