[22654] in Perl-Users-Digest
Perl-Users Digest, Issue: 4875 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 22 11:05:58 2003
Date: Tue, 22 Apr 2003 08:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 22 Apr 2003 Volume: 10 Number: 4875
Today's topics:
Re: Beginners question - directions please... <anthony_w@bigpond.com>
Re: compare two files <barryk2@SPAM-KILLER.mts.net>
Re: compare two files (Helgi Briem)
Re: grep in array <mr@sandman.net>
Re: grep in array (Anno Siegel)
Re: grep in array <mr@sandman.net>
Re: grep in array (Anno Siegel)
Re: grep in array <mr@sandman.net>
Re: Help: ? $next_one == ${next_one} <nobull@mail.com>
Re: korn shell or perl <ian@WINDOZEdigiserv.net>
Re: LWP Problem with 500 (Internal Server Error) Can't <simon.andrews@bbsrc.ac.uk>
Re: Matching multiple lines (Tad McClellan)
Re: Net::Ftp and the use of the FTP user command <D'oh@a.deer>
Re: perl compiler for win32 platform? <simon.andrews@bbsrc.ac.uk>
Re: Perl source install over redhat rpm <eddy@NOSPAMaxa.it>
Re: Perl source install over redhat rpm <knuteNOSPAMPLEASE@trinityproject.org>
Re: Q. Does ActivePerl for Windows require Apache to be (Tad McClellan)
Re: Q. Does ActivePerl for Windows require Apache to be (Helgi Briem)
Re: Q. Does ActivePerl for Windows require Apache to be <jurgenex@hotmail.com>
Re: Remembering previous values of the form. <shah@typhoon.xnet.com>
search question <yhu@mail.nih.gov>
Storable running VERY slowly <simon.andrews@bbsrc.ac.uk>
thread model: share complex data <stacom@stacom-software.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 22 Apr 2003 23:45:54 +1000
From: "Tony" <anthony_w@bigpond.com>
Subject: Re: Beginners question - directions please...
Message-Id: <pan.2003.04.22.13.45.54.196647@bigpond.com>
Hi Mark (And others),
Just replying to my own message - I can confirm that
Mark's work does in fact work just fine...it was me that
wrongly added to the code....
I should have put the config file on the command line after the
program file but did not see it until reading up on the
my file = <>; statement :-(
The program works perfectly!
I would like to do:
my $movies = "/opt/FTG/movie_schedule"; # The path in my test setup...
open (MOVIE_SCH, $movies) or die "Can not open: $movies: $!\n";
my @schedule = <MOVIE_SCH>;
close(MOVIE_SCH) or die "Can not close: $movies: $!\n"; # Play safe :-)
and then read the @schedule data with Mark's nice work as that would
be identical to the "movie_schedule" file.
I will be reading up a bit more before the next question....
On Tue, 22 Apr 2003 15:56:03 +1000, Anthony White wrote:
>
> Hi Mark (And others),
>
> Thank you for your assistance. I have tried to understand
> what goes on here with Perl Beginners books :-) and some
[...very big snip...]
--
------------------------------------------------------------
A linux user...(No spam mail here please)
------------------------------------------------------------
------------------------------
Date: Tue, 22 Apr 2003 08:47:35 -0500
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: compare two files
Message-Id: <MPG.190f03f0ee58d5219897a9@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <3b38898e.0304211743.1daeee39@posting.google.com>, Herb
Burnswell (patyoung13@hotmail.com) says...
> Hi All,
>
> I am a beginner with perl and would greatly appreciate some
> assistance. I want to compare two log files and if they are
> significantly different in size, send myself an email. I would like
> to do something similar to:
>
> #!/usr/bin/perl
>
> $file1 = "logfile1";
> $file2 = "logfile2";
>
> $size1 = `wc -l $file1 | awk '{print \$1}'`;
> $size2 = `wc -l $file2 | awk '{print \$1}'`;
> $diff = "($size1 - $size2)";
>
> if ( "$diff" +- 300 ) {
>
> $commandline = "mailx –s "my subject" me@me.com < warningfile";
> system ( $commandline );
>
> }
>
> exit;
>
> As you can see, I don't know the proper syntax but that is the idea of
> what I need. I really don't know the best way of going about this
> either. Is there an easier way than to use ‘wc –l'? I can't really
> use diff because the files will have different info. Thank you very
> much in advance for any information or links to information provided.
>
> Herb
>
Use the "stat" function to retrieve file information as follows :
$file_status = stat($filename1);
$size1 = $file_status->size;
$file_status = stat($filename2);
$size2 = $file_status->size;
$diff = $size2 - $size1;
if ( $diff < -300 || $diff > 300 ) {
# Size difference is greater than 300
} # IF
--
---------
Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com
------------------------------
Date: Tue, 22 Apr 2003 14:17:43 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: compare two files
Message-Id: <3ea54db4.1034330128@news.cis.dfn.de>
On Tue, 22 Apr 2003 08:47:35 -0500, Barry Kimelman
<barryk2@SPAM-KILLER.mts.net> wrote:
>> I am a beginner with perl and would greatly appreciate some
>> assistance. I want to compare two log files and if they are
>> significantly different in size, send myself an email.
<SNIP>
>Use the "stat" function to retrieve file information as follows :
>
>$file_status = stat($filename1);
>$size1 = $file_status->size;
>$file_status = stat($filename2);
>$size2 = $file_status->size;
>
>$diff = $size2 - $size1;
>if ( $diff < -300 || $diff > 300 ) {
> # Size difference is greater than 300
>} # IF
Isn't that an unnecesssarily complex way to do it?
my $sizediff = abs((-s $file1) - (-s $file2));
if ($sizediff > 300) { # do something }
--
Regards, Helgi Briem
helgi DOT briem AT decode DOT is
------------------------------
Date: Tue, 22 Apr 2003 13:21:51 +0200
From: Sandman <mr@sandman.net>
Subject: Re: grep in array
Message-Id: <mr-C78593.13215122042003@news.fu-berlin.de>
In article <4nhe8rmyi4.fsf@lockgroove.bwh.harvard.edu>,
Ted Zlatanov <tzz@lifelogs.com> wrote:
> >> 1) $& and such special variables are usually unnecessary,
> >> especially for tasks as simple as yours. Your code is badly
> >> written, that's why you're having trouble.
> >
> > So tell me how I set a variable to the full string I found a match
> > in, please.
>
> You could find matches in several full strings in your example, so
> your question is misleading. Use the return value of grep() - it
> returns the list of matched strings (just like the grep utility will
> return a list of matched lines). But please, don't invoke
> keys(%people) on every loop iteration, it's inefficient since we don't
> expect %people to be modified by the loop. Look at the example I
> posted earlier.
Your example was backwards. You foreach'd %people and checked in @names. The
foreach is for @names and I want to match to %people. The reason I questioned
its efficiency was because I would have to run your foreach for every iteration
of the foreach(@names), but it seems now that you thought it was ok to foreach
%people instead. Sorry for the confusion.
Here is the complete code again:
#!/usr/bin/perl
%people = (
"john", "John Andersson",
"will", "William Smith"
);
@names = ("Johnny", "David", "Willy boy", "Richard");
foreach $name (@names){
if ($fullname = grep {$name =~m/$_/i } keys %people){
print "$fullname is a friend of ours!\n"
}
}
I want the output of the above to be:
John Andersson is a friend of ours!
William Smith is a friend of ours!
But it is:
1 is a friend of ours!
1 is a friend of ours!
So it seems that grep is returning 1 for success, not the matched string.
Thanks.
--
Sandman[.net]
------------------------------
Date: 22 Apr 2003 11:29:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: grep in array
Message-Id: <b83936$l50$1@mamenchi.zrz.TU-Berlin.DE>
Sandman <mr@sandman.net> wrote in comp.lang.perl.misc:
> Here is the complete code again:
>
> #!/usr/bin/perl
>
> %people = (
> "john", "John Andersson",
> "will", "William Smith"
> );
>
> @names = ("Johnny", "David", "Willy boy", "Richard");
>
> foreach $name (@names){
> if ($fullname = grep {$name =~m/$_/i } keys %people){
> print "$fullname is a friend of ours!\n"
> }
> }
>
> I want the output of the above to be:
>
> John Andersson is a friend of ours!
> William Smith is a friend of ours!
>
> But it is:
>
> 1 is a friend of ours!
> 1 is a friend of ours!
>
> So it seems that grep is returning 1 for success, not the matched string.
If a Perl function doesn't do what you expect it to, read its documentation.
"perldoc -f grep" will tell you about the behavior of "grep" in scalar
context. Summary:
if ( ($fullname) = grep {$name =~m/$_/i } keys %people){
Anno
------------------------------
Date: Tue, 22 Apr 2003 14:29:46 +0200
From: Sandman <mr@sandman.net>
Subject: Re: grep in array
Message-Id: <mr-AD946F.14294622042003@news.fu-berlin.de>
In article <b83936$l50$1@mamenchi.zrz.TU-Berlin.DE>,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> > Here is the complete code again:
> >
> > #!/usr/bin/perl
> >
> > %people = (
> > "john", "John Andersson",
> > "will", "William Smith"
> > );
> >
> > @names = ("Johnny", "David", "Willy boy", "Richard");
> >
> > foreach $name (@names){
> > if ($fullname = grep {$name =~m/$_/i } keys %people){
> > print "$fullname is a friend of ours!\n"
> > }
> > }
> >
> > I want the output of the above to be:
> >
> > John Andersson is a friend of ours!
> > William Smith is a friend of ours!
> >
> > But it is:
> >
> > 1 is a friend of ours!
> > 1 is a friend of ours!
> >
> > So it seems that grep is returning 1 for success, not the matched string.
>
> If a Perl function doesn't do what you expect it to, read its documentation.
> "perldoc -f grep" will tell you about the behavior of "grep" in scalar
> context. Summary:
>
> if ( ($fullname) = grep {$name =~m/$_/i } keys %people){
Thank you!
Actually, I had no expectations on the function. :)
--
Sandman[.net]
------------------------------
Date: 22 Apr 2003 12:58:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: grep in array
Message-Id: <b83e9e$s1e$1@mamenchi.zrz.TU-Berlin.DE>
Sandman <mr@sandman.net> wrote in comp.lang.perl.misc:
> In article <b83936$l50$1@mamenchi.zrz.TU-Berlin.DE>,
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
[...]
> > > I want the output of the above to be:
> > >
> > > John Andersson is a friend of ours!
> > > William Smith is a friend of ours!
> > >
> > > But it is:
> > >
> > > 1 is a friend of ours!
> > > 1 is a friend of ours!
> > >
> > > So it seems that grep is returning 1 for success, not the matched string.
^^^^^^^^^^^^^^^
> >
> > If a Perl function doesn't do what you expect it to, read its documentation.
> > "perldoc -f grep" will tell you about the behavior of "grep" in scalar
> > context. Summary:
> >
> > if ( ($fullname) = grep {$name =~m/$_/i } keys %people){
>
> Thank you!
>
> Actually, I had no expectations on the function. :)
What I'm saying is, when you find yourself guessing what a function
does, it's time to turn to the docs.
Anno
------------------------------
Date: Tue, 22 Apr 2003 15:43:39 +0200
From: Sandman <mr@sandman.net>
Subject: Re: grep in array
Message-Id: <mr-EFEDD5.15433922042003@news.fu-berlin.de>
In article <b83e9e$s1e$1@mamenchi.zrz.TU-Berlin.DE>,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> > > If a Perl function doesn't do what you expect it to, read its
> > > documentation.
> > > "perldoc -f grep" will tell you about the behavior of "grep" in scalar
> > > context. Summary:
> > >
> > > if ( ($fullname) = grep {$name =~m/$_/i } keys %people){
> >
> > Thank you!
> >
> > Actually, I had no expectations on the function. :)
>
> What I'm saying is, when you find yourself guessing what a function
> does, it's time to turn to the docs.
I agree
--
Sandman[.net]
------------------------------
Date: 22 Apr 2003 14:09:12 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Help: ? $next_one == ${next_one}
Message-Id: <u9smsa7k7b.fsf@wcl-l.bham.ac.uk>
Bob Walton <bwalton@rochester.rr.com> writes:
> ... trying to interpolate the variable in a string where the variable name
> is followed by an alphanumeric character, like "abc${next_one}def" for
> example. That is mostly why the construct is available in Perl -- if
> it weren't, there would be no way to interpolate a variable name
> followed immediately by an alphanumeric character, as the compiler
> would have no way of knowing where the variable name is supposed to
> stop and the literal text start.
Well, at some level that's true. But looking at it another way, if
this construct did not exist then there would have to be another way.
I personally think this construct is ugly and think Perl would have
been a nicer place without it.
We could perfectly well have got around the interpolation problem by
using an escape seqence that interpolates as a null string. Indeed
you can use \E for this purpose but it has other effects too so a
separate null escape would have been preferable.
"abc$next_one\Edef"
This, unfortunately, doesn't help with ${11} et al.
Just my $0.02
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 22 Apr 2003 10:23:32 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: korn shell or perl
Message-Id: <7j5aav02tnllu5bp3bm4t4vvl7md78beq0@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on Tue, 22 Apr 2003 00:57:56 GMT,
phil+s3@bolthole.no-bots.com (Philip Brown) managed to scribble:
> On Mon, 21 Apr 2003 20:58:31 GMT, ian@WINDOZEdigiserv.net wrote:
> >Great Eric, and much appreciated.
> >
> >My primary scripting language is PHP and I use Perl mainly for
> >system scripting [....]
>
> Why not use php? there is an installable /usr/local/bin/php for
> just this purpose :-)
[tk@morris:~]$ which perl
/usr/bin/perl
[tk@morris:~]$ which php
[tk@morris:~]$
Yeah? ;)
I have PHP installed as an Apache module, not CGI binary =)
>
> (or if you would like a prepackaged binary, /opt/csw/bin/php,
> grab mod_php from blastwave.org ;-)
I enjoy expanding my horizons and Perl was my first scripting
language to be used. PHP came about and stuck for Web development for
its flexability and "inline" use within pages and the likes.
I like Perl as a language, so I tend to use this (especially with no
PHP binary) for all system scripting (windoze and Unix) and other
little "tools" (was kinda chuffed with my first ever Perl/Tk app =)
).
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPqUX3Wfqtj251CDhEQJtqwCfUg+V0TWTWo2ouFTHWgqz64uftIkAoJEP
yoIvFMBjULnq+JCNnBuOZnTW
=kxp1
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Scripting, Web design, development & hosting.
------------------------------
Date: Tue, 22 Apr 2003 13:09:10 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: LWP Problem with 500 (Internal Server Error) Can't read entity body
Message-Id: <3EA530E6.5060202@bbsrc.ac.uk>
Chacrint Charinthorn wrote:
> helgi@decode.is (Helgi Briem) wrote in message news:<3e9a7e50.325820274@news.cis.dfn.de>...
>
>>On 12 Apr 2003 06:31:23 -0700, chacrint@hotmail.com
>>(Chacrint Charinthorn) wrote:
>>
>>
>>>I tried to post using LWP but I got the following error:
>>>500 (Internal Server Error) Can't read entity body: Connection
>>>reset by peer
>>
>>Perl doesn't have a 500 error. Web servers do.
>>Is this a stealth CGI question?
[snip default answer to any question mentioning 500!]
You got a couple of answers pointing you to CGI documentation, but
that's not really your problem. In your case the 500 error is coming
from the server you're retrieving your information from not from a local
server which is trying to run your script.
> below is the output of LWP logfile. Moreover, the script is run on the command line
>
> # LWP::DebugFile logging to ./tmp/lwp_3ea2ca44_59a9.log
> # Time now: {1050856004} = Sun Apr 20 23:26:44 2003
> LWP::UserAgent::new: ()
> LWP::UserAgent::request: ()
> LWP::UserAgent::send_request: POST http://www.target.com/Service.php
> LWP::UserAgent::_need_proxy: Not proxied
> LWP::Protocol::http::request: ()
> # Time now: {1050856184} = Sun Apr 20 23:29:44 2003
> LWP::UserAgent::request: Simple response: Internal Server Error
OK, so in a way your script is working fine. Your request is being sent
and an answer is retrieved from the server at the other end. The
problem is that the parameters you sent the script at the other end
caused it to throw a hissy fit and not return a valid http response, you
therefore get the error from the web server at the other end.
This is probably because of one of the following:
1) The URL you are sending the request to is wrong (unlikely since
something is listending (and probably crashing) at the other end, though
having said that I got a 404 when I tried www.target.com/Service.php
just now).
2) The parameters you are sending are incomplete or incorrect (more
likely). Check carefully against the list of parameters the script
expects. Remember that parameters and arguments may be case sensitive.
Make sure you're sending all the parameters the script expects.
Include even those you don't use, including the name of the submit button!
If you have permission to reverse engineer this script then ask the
webmaster at target.com what error the php script is producing when it
dies. This will help you to debug the parameters you are passing.
Hope this helps
Simon.
------------------------------
Date: Tue, 22 Apr 2003 00:16:02 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Matching multiple lines
Message-Id: <slrnba9k0i.nnd.tadmc@magna.augustmail.com>
Sara <genericax@hotmail.com> wrote:
> "rjh" <ccsc3618@bigpond.net.au> wrote in message news:<qcIoa.3876$8K2.31788@news-server.bigpond.net.au>...
>
> .
> .
>> Im trying to search the file for the ---------- delimiter and then read the
>> data into an array, then search the
>> array for a match and then print out the array. My current solution doesnt
>> work very well.
>> Has anyone attempted anything similar to this ??
>>
> .
> .
>
> Probabilistically, I'd say it's almost a certainty someone has tried
> this. If I we're in your position I'd want to study up on the "m" and
> "s" regex options, like
>
> print "yay its here!\n" if $paragraph =~ /mystring/ms;
But not like that (when both options are no-ops).
m//s only affects dot (.), it is useless when there is no dot
in the pattern.
m//m only affects start/end anchors (^ and $), it is useless when there
are no anchors in the pattern.
> You can mess around with EOL terminators
Do you mean "input record terminators", ie $/ ?
> too but this is probably more
> practical.
They address 2 completely different things.
There are always 2 things to consider when evaluating a pattern match,
the pattern, and the string that the pattern is to be matched against.
"s" and "m" may help with the pattern when processing multilines.
$/ may help with getting the string to match against when
processing multilines.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Apr 2003 22:03:46 +1000
From: D'oh <D'oh@a.deer>
Subject: Re: Net::Ftp and the use of the FTP user command
Message-Id: <3EA52FA2.50891664@a.deer>
Trevor Hales wrote:
>
> Behold a list of the problem I am attempting to solve using Perl...
>
> Please find attached an ftp session show how you can
> login again as a user...
> ftp
> Connected to
> 220 tigger FTP server (...) ready.
> Name (:thales): anonymous
> 331 Guest login ok, send ident as password.
> Password:
> 230 Guest login ok, access restrictions apply.
> ftp> user
> (username)
> 331 Password required for
> Password:
> 230 User logged in.
> ftp> ls -tl
> 200 PORT command successful.
> ...............
> 221 bytes received in 0.24 seconds (0.90 Kbytes/s)
> ftp>
>
Trevor, hope you realise that you already have at least three postings with
the same question still active in this newsgroup.
I have given you sample code for a simple FTP login. Here is it again;
***** Code starts here
#!/bin/perl
use warnings;
use strict;
use Net::FTP;
my ($username, $password);
my @files = qw(abc.zip xyz.zip);
$username="anonymous";
$password="guest";
my $ftp=Net::FTP->new("ftp.doh.com.au", Timeout=>120) or die $!;
$ftp->login($username, $password) or die $!;
$ftp->binary();
$ftp->cwd("/files/dos/backup") or die $!;
for (my $i=0; $i<scalar(@files); $i++) {
$ftp->get("$files[$i]") or print("Error $! or file not found!");
}
$ftp->close;
***** Code ends here
Check
perldoc Net::FTP (http://theoryx5.uwinnipeg.ca/CPAN/perl/Net/FTP.html)
perldoc Net::Cmd (http://theoryx5.uwinnipeg.ca/CPAN/perl/Net/Cmd.html)
My version of Net::FTP doesn't have a "user" method, so you may have
to use Net::Cmd. I'd like to help further, but I don't have access
to two different FTP sites. Not for an FTP connection as you've
described above anyway.
The other thing is you can try to perform a second FTP->new like;
my $ftp_outer=Net::FTP->new("ftp.doh.com.au", Timeout=>120) or die $!;
$ftp_outer->login($username, $password) or die $!;
my $ftp_inner=Net::FTP->new("ftp.doh.com.au", Timeout=>120) or die $!;
$ftp_inner->login($username, $password) or die $!;
I've never tried it though, so I can't say if it'll work or not.
------------------------------
Date: Tue, 22 Apr 2003 11:46:28 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: perl compiler for win32 platform?
Message-Id: <3EA51D84.2090408@bbsrc.ac.uk>
ZZT wrote:
> Simon Andrews wrote:
>
>> Get the latest version of PAR from CPAN. It includes a tool called pp
>> which will turn any Perl program into a windows .exe (you may also
>> have to distribute a perl dll).
>>
>> It works really well now, even on complex GUI-based scripts.
>>
>> http://search.cpan.org/author/AUTRIJUS/PAR-0.67/
>>
>> Pretty easy to install too. No C-compiler necessary, and a very
>> helpful makefile script.
>
> Simon, where can I get the binary parl.exe ?
> I get an error back from pp:
> can't find par loader
All you should need to do is to download the tar.gz from the address I
gave you above, and unzip it to a temp directory (making sure you keep
the folder organisation in the tar file), then open a command shell,
move to that directory and type
perl Makefile.PL
..then sit back whilst it checks everything it needs. If you've not run
it before then it will probably download nmake.exe for you. Once this
has completed you run (in the same directory)...
nmake
nmake test
nmake install
..and that's it, it should all be installed for you. If this doesn't
work then let us know at which stage it fails, and with what error
Hope this helps
Simon.
------------------------------
Date: Tue, 22 Apr 2003 14:06:50 +0200
From: "Eddy" <eddy@NOSPAMaxa.it>
Subject: Re: Perl source install over redhat rpm
Message-Id: <b83b86$fec$1@lacerta.tiscalinet.it>
if I type:
/usr/local/bin/perl -V
I have:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:...
@INC:
/usr/local/lib/perl5/5.8.0/i686-linux
/usr/local/lib/perl5/5.8.0
/usr/local/lib/perl5/site_perl/5.8.0/i686-linux
/usr/local/lib/perl5/site_perl/5.8.0
/usr/local/lib/perl5/site_perl
if I type:
/usr/bin/perl -V
I have:
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:...
/usr/local/lib/perl5/5.8.0/i686-linux
/usr/local/lib/perl5/5.8.0
/usr/local/lib/perl5/site_perl/5.8.0/i686-linux
/usr/local/lib/perl5/site_perl/5.8.0
/usr/local/lib/perl5/site_perl
I am having problems with openwebmail, it seems that when it uses
Text::Iconv it crashes.. Text::Iconv itself works (test passed perfectly)
I was thinking that my perl installation is not ok.. it is possible to clean
up in some ways? how can I set INC for the second (old) copy of perl?
Thank you
Edoardo
"Pierre Asselin" <pa@panix.com> ha scritto nel messaggio
news:b824d7$6uq$2@reader1.panix.com...
> Eddy <eddy@nospamaxa.it> wrote:
> > On my RH 6.2 I have tryed to upgrade Perl to 5.8 with source version
>
> > It seems that the lib directories have mixed together with the old rpm
> > version from redhat:
> > [ . . . ]
> > perl -V says:
> > @INC:
> > /usr/local/lib/perl5/5.8.0/i686-linux
> > /usr/local/lib/perl5/5.8.0
> > /usr/local/lib/perl5/site_perl/5.8.0/i686-linux
> > /usr/local/lib/perl5/site_perl/5.8.0
> > /usr/local/lib/perl5/site_perl
>
> That looks perfectly normal. The new perl in /usr/local/bin uses
> only /usr/local/lib/perl5. Try the old one with "/usr/bin/perl -V",
> and make sure it only looks under /usr/lib/perl5.
>
> What stopped working exactly?
>
------------------------------
Date: Tue, 22 Apr 2003 14:01:47 GMT
From: "Knute Snortum" <knuteNOSPAMPLEASE@trinityproject.org>
Subject: Re: Perl source install over redhat rpm
Message-Id: <fXbpa.20626$yO5.624@nwrddc02.gnilink.net>
"Eddy" <eddy@NOSPAMaxa.it> wrote in message
news:b83b86$fec$1@lacerta.tiscalinet.it...
> I am having problems with openwebmail, it seems that when it uses
> Text::Iconv it crashes.. Text::Iconv itself works (test passed perfectly)
> I was thinking that my perl installation is not ok.. it is possible to
clean
> up in some ways? how can I set INC for the second (old) copy of perl?
*sigh*
Please describe what's happening. Saying "it crashes" tells us nothing.
Look in perlvar for how to change @INC. I'll probably get yelled at for
posting documentation, but here you go:
The array @INC contains the list of places that the do EXPR, require, or use
constructs look for their library files. It initially consists of the
arguments to any -I command-line switches, followed by the default Perl
library, probably /usr/local/lib/perl, followed by ``.'', to represent the
current directory. If you need to modify this at runtime, you should use the
use lib pragma to get the machine-dependent library properly loaded also:
use lib '/mypath/libdir/';
use SomeMod;
--
-- Knute Snortum
"Sure, I drink six 8-ounce glasses of water a day. I just like my water
hot and filtered through ground coffee beans."
------------------------------
Date: Tue, 22 Apr 2003 00:31:12 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Q. Does ActivePerl for Windows require Apache to be installed ?
Message-Id: <slrnba9kt0.nnd.tadmc@magna.augustmail.com>
Jim Jones <harley.davidson@mailcity.com> wrote:
> On Mon, 21 Apr 2003 10:08:05 -0500, Chris Olive <nospam@raytheon.com>
> wrote:
>>Jim Jones wrote:
>>> On Mon, 21 Apr 2003 02:49:45 GMT, "Jürgen Exner"
>>> <jurgenex@hotmail.com> wrote:
>>>>Jim wrote:
>>>>[Does ActivePerl for Windows require Apache to be installed ?]
>>>>Of course not.
>>>>Why would you possibly think it would?
Perl is not CGI.
CGI is not Perl.
Perl had a robust following before the WWW was even invented!
You can do CGI in just about any programming languge: Java, C++, VB...
Perl is a general-purpose programming language (though a whole lot
of people choose it when they need to write CGI programs).
>>> Because I was just not sure. I want to get started practicing Perl for
>>> web stuff, and just didnt know. I have NT4 and loaded Apache2 which
>>> works fine. I now want to add Perl so I can start working with it.
>>>
>>> Please advise, given my scenario.
CGI programming is a somewhat advanced application area.
Learn Perl itself first.
> Yes, I did load it because I thought I needed to, to start practicing
> Perl for enhancing my web pages.
But now you know that you did not need it to learn Perl, right?
> I'd intended to install a Perl interpreter on top of the newly
> isntalled Apache2 server on my nt box.
Learn Perl from the command line first.
>>since PerlScript REQUIRES running IIS...
>
> Then, I don't want the one that requires running IIS.
That would be real Perl then. This is the place.
> I don't want to run anymore MS sfuff, right now than I already am.
I like you already. :-)
> Also, is this the right group to be posting my newbie questions?
Yes.
But you are expected to spend a few minutes trying to find the
answers yourself. If you look and still don't find, post away!
(and say where you've looked).
See the Posting Guidelines that are posted here frequently for
some suggestions on how to do your few minutes worth of looking.
> If there's a more appropriate one to post my fundamental questions,
But there are beginner's mailing lists too:
http://lists.perl.org/showlist.cgi?name=beginners
http://lists.perl.org/showlist.cgi?name=beginners-cgi
> I'd be delighted to, because I learn more slowly than most.
That has already been proven false.
We have some real dolts pass thru here from time to time...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Apr 2003 11:05:24 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Q. Does ActivePerl for Windows require Apache to be installed ?
Message-Id: <3ea52198.1023037640@news.cis.dfn.de>
On Sun, 20 Apr 2003 17:42:48 GMT,
harley.davidson@mailcity.com (Jim Jones) wrote:
>>> Does ActivePerl for Windows require Apache to be installed ?
>>
>>No, it doesn't.
>
>Thank you very much for your help. I sure wish that the ActiveState
>site mentioned that little fact which has had me confused all day.
Why on earth should Activestate mention that??
Should they also mention all the other programs that
don't have to be installed to run Activeperl?
That's a damn long list, you know. Takes a lot of
disk space, too.
--
Regards, Helgi Briem
helgi DOT briem AT decode DOT is
------------------------------
Date: Tue, 22 Apr 2003 14:58:06 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Q. Does ActivePerl for Windows require Apache to be installed ?
Message-Id: <2Mcpa.2968$ra4.1631@nwrddc01.gnilink.net>
Chris Olive wrote:
> PerlScript != Perl # strictly speaking
Right!
> Seeing that you've loaded Apache however (and I can't tell if you
> loaded Apache because you thought you needed to do so, or because
> that's exactly what you wanted to do), then maybe you aren't talking
> about PerlScript since PerlScript REQUIRES running IIS...
Wrong. Dead wrong.
PerlScript requires a web browser that is capable of running PerlScript. The
only way I know of is to install the PerlScript plugin from ActiveState
which is available for IE only.
And then IE will happily render any local DHTML page containing a PerlScript
script and execute it.
No need for Apache or IIS or any web server at all.
Of course as you pointed out that doesn't help the OP who wants to learn
Perl, not PerlScript.
jue
------------------------------
Date: Tue, 22 Apr 2003 14:50:18 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: Re: Remembering previous values of the form.
Message-Id: <b83kra$eea$1@flood.xnet.com>
In comp.lang.javascript Bryan Castillo <rook_5150@yahoo.com> wrote:
:)>
:)> 2) When building the HTML form, perl script would add hidden variables to the
:)> HTML form. When the user updates the entries in the form, the javascript
:)> would generate psuedo SQL code based on the changes made by the user.
:)> When user presses "Save" button, another perl script would be executed.
:)> The second perl script would retrieve the hidden variable using param()
:)> and build SQL statement and execute it.
:)
:)
:)I don't have alot to contribute except a warning. (sorry)
:)
:)The idea of (client-side) javascript generating psuedo SQL scares me
:)to death and I hope your database does not support subqueries or
:)multiple statements in one query (separated by ';').
No it does not. I will not be generating SQL on the client side.
I have 2 opions as i see it:
1) Delete all entries retrieved from the database, and insert entries found
in the form.
2) Determine on client side what changed and send data back to the server,
on server side I can pass the variables and take appropriate action on the
database.
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
------------------------------
Date: Tue, 22 Apr 2003 10:00:22 -0400
From: Ying Hu <yhu@mail.nih.gov>
Subject: search question
Message-Id: <3EA54AF6.AF26D76B@mail.nih.gov>
Hi All,
I have two data sets as the following:
Data set 1:
ID1 from1 to1
A1 23 59
A2 69 120
A3 200 239
...
...
Y2000 3900000 3900032
Data set 2:
ID2 from2 to2
a1 126 130
a2 201 212
...
...
y20 240028 240032
How to quick search two IDs, one in data set 1 and other in data set 2,
when the range of the ID of data set 2 is in/overlap of the ID of data
set 1, such as:
A3 a2
Thanks
Ying
------------------------------
Date: Tue, 22 Apr 2003 11:39:00 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Storable running VERY slowly
Message-Id: <3EA51BC4.5030701@bbsrc.ac.uk>
I am using the Storable module to save a complex data structure which I
later wish to retrieve. The structure itself is an object based on a
hash of hashes (all containing scalar data, no sub-objects or circular
references or anything like that).
The problem I'm getting is that storing this object is proving to be
VERY slow (often 5+ mins at 100% CPU). The stored data runs to about
8Mb once saved, and retrieves in a couple of seconds. I'd like to know
what I could do to speed this up.
The code I'm using to store the data is this:
sub export {
# This sub exports the data in the hashref
# object to a file-based data structure
# using the Storable module.
my ($hashref,$filename) = @_;
return("No filename specified") unless ($filename);
unless (Storable::store($hashref,$filename)){
return ("Failed to save data to $filename");
}
return(0);
}
As a test I also tried retrieving the stored data, and then storing it
again using this code.
#!/usr/bin/perl -w
use strict;
use Storable;
print "Retrieving File\n";
my $hashref = retrieve('quantarray.ary') || die "Can't retrive file:$!";
print "Storing File\n";
Storable::store ($hashref,'stored_file.ary') || die "Can't store file:$!";
print "Done\n";
In this case the data stored in a few seconds, yet it should be the same
data structure I created in my main application, so I don't see why the
store times would be so different.
Does anyone have a suggestion on how I can troubleshoot this?
Cheers
Simon.
------------------------------
Date: Tue, 22 Apr 2003 16:39:34 +0200
From: Alexander Eisenhuth <stacom@stacom-software.de>
Subject: thread model: share complex data
Message-Id: <b83k62$62sol$1@ID-155280.news.dfncis.de>
Hallo everybody,
I'm quite new to perl, so please "forbear with me" (hope that this word applies) ...
In the end I want a container with some extra methods (here CDB) to store
objects refs (CB, CA - with a lot of attributes) in it. The attributes of this
objects are set and read of different sources (serial device, socket:distributed
part ot this application). The approach, that "I need" two threads lies in
latancy of the application.
The following script shows the classes without any sharing, so the objects lifes
independantly and thread2 dies. My question is how I must arrange the container
and the data objects, which parts must be shared and blessed, or weather my
"architecture" won't fit into the thread modell of perl.
Thanks a lot for your help in advance.
Alexander
################################
package CA;
################################
use threads;
use threads::shared;
sub new {
my $packageName = shift;
my %params = (argA=>undef, @_);
my $self = {};
bless $self, $packageName;
$self->{argA} = $params{argA};
return $self;
}
sub setArgA {
my $self = shift;
my %params = (argA=>undef, @_);
$self->{argA} = $params{argA};
}
sub getArgA {
my $self = shift;
return $self->{argA};
}
# CB derived from CA
################################
package CB;
################################
use threads;
use threads::shared;
@ISA = qw (CA);
sub new {
my $packageName = shift;
my %params = (argA=>undef,argB=>undef, @_);
my $self = CA->new(argA=>$params{argA});
bless $self, $packageName;
$self->{argB} = $params{argB};
return $self;
}
sub setArgB {
my $self = shift;
my %params = (argB=>undef, @_);
$self->{argB} = $params{argB};
}
sub getArgB {
my $self = shift;
return $self->{argB};
}
################################
package CDB;
################################
use threads;
use threads::shared;
sub new {
my $packageName = shift;
my %db = {};
my $self = {};
bless $self, $packageName;
$self->{db} = \%db;
return $self;
}
sub add {
my $self = shift;
my %params = (dbKey=>undef, dbElement=>undef, @_);
# print "add($self):", $params{dbElement},"\n";
$self->{db}->{$params{dbKey}} = $params{dbElement};
}
sub getObjRef {
my $self = shift;
my %params = (dbKey=>undef, @_);
if (not exists $self->{db}->{$params{dbKey}}) {
die "DP with key:", $params{dbKey} ," does not exist";
}
# print "get($self):", $params{dbKey}," ", $self->{db}->{$params{dbKey}},"\n";
return $self->{db}->{$params{dbKey}};
}
################################
package main;
################################
use threads;
use threads::shared;
$dbObj = CDB->new();
my $bObj = CB->new(argA=>12, argB=>13);
$dbObj->add(dbKey=>'01', dbElement=>$bObj);
my $t1 = create threads \&thread1, $dbObj;
my $t2 = create threads \&thread2, $dbObj;
# -- wait for return
$a = <STDIN>;
sub thread1 {
my ($dbObj) = @_;
my $dbRef = $dbObj->getObjRef(dbKey=>'01');
$dbRef->setArgA(argA=>20);
$dbRef->setArgB(argB=>20);
}
sub thread2 {
my ($dbObj) = @_;
sleep 1;
my $dbRef = $dbObj->getObjRef(dbKey=>'01');
my $val = $dbRef->getArgA();
if ($val != 20) {
die "ERROR: thread value is: $val\n";
}
print ">>> ---- thread safety of DB passed with success ---- <<<<\n";
}
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 V10 Issue 4875
***************************************