[17220] in Perl-Users-Digest
Perl-Users Digest, Issue: 4642 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 17 14:06:26 2000
Date: Tue, 17 Oct 2000 11:05:20 -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: <971805919-v9-i4642@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 17 Oct 2000 Volume: 9 Number: 4642
Today's topics:
Re: "Lite" Perl book required (Jon S.)
[Q] No output <bh_ent@my-deja.com>
Re: [Q] No output <james@NOSPAM.demon.co.uk>
Abiguity of $ in regular expression (was: Problem with nobull@mail.com
ANDing of variables? <bruce_phipps@my-deja.com>
Re: ANDing of variables? (Greg Bacon)
Re: ANDing of variables? <james@NOSPAM.demon.co.uk>
Basic CGI question <stephen.dishon@northernlight.co.uk>
Re: Basic CGI question <jeff@vpservices.com>
Re: Basic CGI question nobull@mail.com
branch coverage testing <leinhos@fc.hp.com>
Bytemanipulating <josef.zellner@aon.at>
Re: Can not substitute a "\n" with a regular expression <godzilla@stomp.stomp.tokyo>
Re: Can not substitute a "\n" with a regular expression (Al)
converting a binary file to ascii <pauls_spam_no@pauls.seanet.com>
Re: converting a binary file to ascii <anmcguire@ce.mediaone.net>
Re: CPAN.pm gripe (NP)
Re: Create a copy of a variable <ren.maddox@tivoli.com>
ERROR (Gordos.com)
Re: ERROR <calle@lysator.liu.se>
Re: ERROR <godzilla@stomp.stomp.tokyo>
Re: filtering with a script nobull@mail.com
Re: IO::Socket falls over under Perl 5.6.0 nobull@mail.com
LockFile::Simple - using the PID information jeacocks@uk.ibm.com
Re: LockFile::Simple - using the PID information (Clay Irving)
Re: Make this regex neater, anyone? <anmcguire@ce.mediaone.net>
Re: Maximum file size? <mkt@bphltd.demon.co.uk>
Re: Maximum file size? <jeff@vpservices.com>
Re: MS Access <mdorrel@fsnet.co.uk>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 Oct 2000 16:18:31 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Re: "Lite" Perl book required
Message-Id: <39ec7acf.10465962@news.earthlink.net>
On Mon, 16 Oct 2000 18:30:10 +0100, James Taylor
<james@NOSPAM.demon.co.uk> wrote:
>In article <39EB199C.DA3E636F@vpservices.com>, Jeff Zucker
><URL:mailto:jeff@vpservices.com> wrote:
>> "Randal L. Schwartz" wrote:
>> >
>> > However, for programmers already versed in language such as C or awk,
>> > you probably could skip all the parts of that redundancy, and spend
>> > your first 40 hours concentrating on just Perl. I think I know a book
>> > or two that does that, and rather effectively I'm told. :)
>>
>> I second those two recommendations. The second one, obscurely mentioned
>> by Randal, is, unless I am mistaken _Learning Perl_ from O'Reilly, an
>> excellent introduction to Perl for those with some Unix or other
>> programming background and probably a good companion to Johnson's book
>> in any case.
>
>I learnt Perl from "Learning Perl" and found it a breeze. Most certainly
>"lite" but also entertainingly written, which I think was the intention.
>Prior to getting into Perl I had not had much experience with UNIX, only
>a little C and no awk at all, but despite that I found "Learning Perl"
>almost too "lite". I would read it on the train to/from work, read it
>in bed, in the bath, wherever; flipping the pages faster and faster in
>a hungry desire to find out more. When I finished, I felt like I'd just
>had a light snack, and needed to consume more. I'm not saying that I felt
>dissatisfied, because Learning Perl will teach you enough to write your
>own programs with confidence.
Yeah, I think that's the sign of a good learning book. I too didn't
have much Unix or other experience and didn't have problems with
Learning Perl. But, it's not very good as a reference (not supposed
to be one), once you've learned it and written your thousand or two
lines of code, you don't reference it very often. I bought Perl in a
Nutshell and have found it useful, but a little bit too "FAQ-ish" for
a relative newbie to use effectively, even after Learning Perl.
Borrowing an O'Reilly Unix book from the library helped on the Unix
parts later on.
Jon
------------------------------
Date: Tue, 17 Oct 2000 16:29:08 GMT
From: bh <bh_ent@my-deja.com>
Subject: [Q] No output
Message-Id: <8shuo7$ric$1@nnrp1.deja.com>
I am trying to write a little perl program that will parse the UID and
login name from the password file. I have a book that has this exact
program in it, but it does not use the 'strict' methodology. I am
having trouble getting the prog to work under the strict guidline. Any
suggestions? I know I'm probably missing something small, but I just
am not seeing it.
Thanks in advance!
#/usr/bin/perl -w
use strict;
# Get current UID list
setpwent();
while (my @list = getpwent()) {
my ($login,$uid) = @list[0,2];
my %uid;
$uid{$login} = $uid;
# print "UID of $login is $uid\n";
}
endpwent();
my (%uid, $login);
my @keys = sort { $uid{$a} cmp $uid{$b} } keys %uid;
foreach $login (@keys) {
print "UID of $login is $uid{$login}\n";
}
--
bh
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 17 Oct 2000 18:06:45 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: [Q] No output
Message-Id: <ant1717457d6fNdQ@oakseed.demon.co.uk>
In article <8shuo7$ric$1@nnrp1.deja.com>, bh
<URL:mailto:bh_ent@my-deja.com> wrote:
> #/usr/bin/perl -w
>
> use strict;
>
> # Get current UID list
> setpwent();
> while (my @list = getpwent()) {
> my ($login,$uid) = @list[0,2];
> my %uid;
> $uid{$login} = $uid;
> # print "UID of $login is $uid\n";
> }
At this point %uid goes out of scope and so you lose what you've just
put in it.
> endpwent();
> my (%uid, $login);
If %uid was not out of scope this "my" declaration would give an error.
In this case %uid is now empty so the following loop prints nothing.
> my @keys = sort { $uid{$a} cmp $uid{$b} } keys %uid;
> foreach $login (@keys) {
> print "UID of $login is $uid{$login}\n";
> }
I suggest you move the "my %uid;" out of the first loop and
place it above the loop, and don't my %uid again before the
second loop.
--
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: 17 Oct 2000 18:07:02 +0100
From: nobull@mail.com
To: kenlaird@yahoo.com (Ken Laird)
Subject: Abiguity of $ in regular expression (was: Problem with a regular expression (Please Help))
Message-Id: <u9lmvnxuq1.fsf@wcl-l.bham.ac.uk>
kenlaird@yahoo.com (Ken Laird) writes:
> Subject: Problem with a regular expression (Please Help)
"Problem with a" and "(Please Help)" convey no useful information.
Space is tight in subject lines, don't waste it.
What's left after noise removal, "regular expression" is really a very
vague subject.
Apply the following rule: I you were about to post your question to
Usenet and you saw an existing thread with the same subject line would
you realise it was the same topic. If the answer is "no" then you
need to change your subject line before you post.
> if (/^thing=$var$/) {
> I wanna get beginning of thing (^) with end of something ($) ,
> it seems to work ,but it looks a bit odd to me.
> I'm worried if there could be any exceptions that won't work.
I trust you want the contents of $var to be interpreted as a regular
expression. If you want the contents of $var to be interpreted as a
plain string then you need \Q before $var in that pattern.
> The dollar in the middle worries me , or maybe it's correct ?
It is correct.
> How perl tells the difference between both $ ??
IIRC a dollar that isn't followed by an alphanumeric or opening brace
is not a candidate for interpolation.
In practice any dolar being used to represent "end of line" in a RE
would never be followed by an alphanumeric or opening brace.
This means that the potential abiguity doesn't actually ever arise and
Perl will "Do What I Mean".
For details, perldoc perlop/"Gory details of parsing quoted constructs"
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 17 Oct 2000 16:15:58 +0100
From: "Bruce Phipps" <bruce_phipps@my-deja.com>
Subject: ANDing of variables?
Message-Id: <8shqgq$p1m$1@sshuraaa-i-1.production.compuserve.com>
Found this code (actually in a subroutine of POP3Client.pm) and can't figure
out what it does...
================
my ($me, $host, $port) = @_;
$host and $me->Host($host); # how does and work here -- what is the result?
$port and $me->Port($port); # ditto
===============
Any info. welcomed.
TIA
Bruce
------------------------------
Date: Tue, 17 Oct 2000 15:24:29 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: ANDing of variables?
Message-Id: <suorpdmosljrb8@corp.supernews.com>
In article <8shqgq$p1m$1@sshuraaa-i-1.production.compuserve.com>,
Bruce Phipps <bruce_phipps@my-deja.com> wrote:
: my ($me, $host, $port) = @_;
:
: $host and $me->Host($host); # how does and work here -- what is the result?
: $port and $me->Port($port); # ditto
It's a flow control mechanism. The following are logically equivalent:
$host and $me->Host($host);
if ($host) { $me->Host($host) }
$me->Host($host) if $host;
You can test for failure, too. Consider the common idiom
open FILE, $file or die "$0: open $file: $!";
Greg
--
Let me guess: you're a Windows ``programmer'', aren't you? Do you
know why Unix programmers make more money than Windows ``programmers''?
Because we Unix people know how to read the manual -- and you don't.
-- Tom Christiansen
------------------------------
Date: Tue, 17 Oct 2000 16:28:15 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: ANDing of variables?
Message-Id: <ant171515063fNdQ@oakseed.demon.co.uk>
In article <8shqgq$p1m$1@sshuraaa-i-1.production.compuserve.com>, Bruce Phipps
<URL:mailto:bruce_phipps@my-deja.com> wrote:
>
> $host and $me->Host($host); # how does and work here -- what is the result?
> $port and $me->Port($port); # ditto
These are just a shorthand for:
if ($host) { $me->Host($host) }
if ($port) { $me->Port($port) }
It works because the right side of the "and" only gets evaluated if
the left side is false. This is called lazy evaluation because if one
argument to a logical and is false then Perl does not need to evaluate
the other side to know that the whole thing is false. Of course the
final result of the and is discarded.
--
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02
------------------------------
Date: Tue, 17 Oct 2000 16:07:36 +0100
From: "Stephen Dishon" <stephen.dishon@northernlight.co.uk>
Subject: Basic CGI question
Message-Id: <39ec6a9a_1@nnrp1.news.uk.psi.net>
I wish to use a CGI script on my site. Say Matt's Script Archive
countdown.pl.
Can I setup a cgi-bin DIR on my harddisk to mimic the one on the server
while I program and test or does it have to be on the ISP's server?
Ta,
Stephen
------------------------------
Date: Tue, 17 Oct 2000 09:01:35 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Basic CGI question
Message-Id: <39EC77DF.A5EB1DFE@vpservices.com>
Stephen Dishon wrote:
>
> I wish to use a CGI script on my site. Say Matt's Script Archive
> countdown.pl.
NO. Do not say Matt's Script Archive. If you want to know why, look up
the word "Matt" in the archives of this newsgroup and you will see
hundreds, if not thousands of posts warning newbies away from the
mistaken-ridden scripts from there.
> Can I setup a cgi-bin DIR on my harddisk to mimic the one on the server
> while I program and test or does it have to be on the ISP's server?
You can do it on your own computer, but you need to install a web server
on your hard disk. Apache has free easily installable versions for most
platforms, others are available as well.
--
Jeff
------------------------------
Date: 17 Oct 2000 18:09:31 +0100
From: nobull@mail.com
Subject: Re: Basic CGI question
Message-Id: <u9hf6bxulw.fsf@wcl-l.bham.ac.uk>
"Stephen Dishon" <stephen.dishon@northernlight.co.uk> writes:
> Subject: Basic CGI question
You have correctly identified that this is a CGI question... _not_ a
Perl question.
This is a Perl group, why do you post here? (And before you say
"because the CGI script is written in Perl" ask yourself this: if you
had a question about coffee would you post to a ceramics group because
your coffee cups are ceramic?
> I wish to use a CGI script on my site. Say Matt's Script Archive
> countdown.pl.
>
> Can I setup a cgi-bin DIR on my harddisk to mimic the one on the server
> while I program and test or does it have to be on the ISP's server?
CGI scripts need to be on a web server. The web server does not need
to belong to an ISP. Free Web server software is available for (and,
for recent versions, usually bundled with) all popular operating
systems. This has nothing whatsoever to do with Perl, it is true of
CGI scripts written in any programming language.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 17 Oct 2000 12:00:18 -0600
From: Matt Leinhos <leinhos@fc.hp.com>
Subject: branch coverage testing
Message-Id: <Pine.LNX.4.21.0010171159090.2500-100000@segovia.fc.hp.com>
Hello,
Could anyone tell me if there is a branch coverage test program/script for
perl? I am interesting in testing all the branches of a perl script I've
been working on.
Thank you in advance,
Matt Leinhos
------------------------------------------------------------------
Matt Leinhos Hewlett-Packard
T-898-1580 Manageability Solutions Lab
matt_leinhos@hp.com Fort Collins, CO
Work hours: TR 8am-3.30pm
------------------------------
Date: Tue, 17 Oct 2000 17:36:39 +0000
From: Joe <josef.zellner@aon.at>
Subject: Bytemanipulating
Message-Id: <39EC8E27.B2F43EE0@aon.at>
Hi there!
Can i do this...
-----------------
struct abc
{
int first : 3;
int second : 5;
}
-----------------
somehow in perl?
With this statements, "first" consists of 3 bits and "second" consists
of 5 bits. I can set them independent from each other but also handle
them together as one Byte (with the struct abc).
Is something like that also possible in perl?
TIA
------------------------------
Date: Tue, 17 Oct 2000 09:15:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Can not substitute a "\n" with a regular expression!
Message-Id: <39EC7B08.3D1EE5B2@stomp.stomp.tokyo>
desperate5011@my-deja.com wrote:
> my problem is to substitute some '\n' in a string
> which i read in with a perl-script.
> I have to substitute them with the HTML-Tag '<br>'
> and then store that string in a DB.
> I tried it whith this:
> $string =~ s/\n/<br>/gs; and with
> $string =~ s/\n/<br>/gm;
> Well, to my surprise the regular expression DID NOT
> substitute the '\n'.
Use of common sense will lead you to another surprise.
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-type: text/plain\n\n";
$data = "test line 1
test line 2
test line 3";
$data =~ s/\n/<BR>/g;
print $data;
exit;
PRINTED RESULTS:
________________
test line 1<BR> test line 2<BR> test line 3
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: Tue, 17 Oct 2000 17:48:27 GMT
From: nospamapgraham@ispchannel.com--- (Al)
Subject: Re: Can not substitute a "\n" with a regular expression!
Message-Id: <39ee9006.100436677@news.ispchannel.com>
On Tue, 17 Oct 2000 09:23:42 GMT, desperate5011@my-deja.com wrote:
>Hello everybody,
>
>my problem is to substitute some '\n' in a string which i read in with a
>perl-script.
>
>I have to substitute them with the HTML-Tag '<br>' and then store that
>string in a DB. I tried it whith this:
>
>$string =~ s/\n/<br>/gs; and with
>
>$string =~ s/\n/<br>/gm;
>
>Well, to my surprise the regular expression DID NOT substitute the '\n'.
>
>Nope, in my DB there was after this a '\n<br>'. The RegExp ADDED the
>'<br>' to the '\n'.
>
>After a lot of reading in perl documentation (and newsgroups ) i still
>don't know what i am doing wrong. Can anybody out there tell me why that
>%$&%(§! RegExp doesn't work?
>
>Thanks
>Michael Engels
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
I use
$text =~ s/\r\n/<BR>/g;
to catch carriage returns and newlines.
better yet is
$text =~ s/\015\012/<BR>/g;
This should work for windows, *nix, and MacOS text.
These lines are in use in working scripts on a Sun Solaris.
-Al-
------------------------------
Date: Tue, 17 Oct 2000 09:15:00 -0700
From: Paul Spitalny <pauls_spam_no@pauls.seanet.com>
Subject: converting a binary file to ascii
Message-Id: <39EC7B03.1C456A08@pauls.seanet.com>
Hi,
I have a binary file, how can I convert it to ascii? I think I need to
read in the file byte by byte but can't figure out how to do it. Any
help appreceated!
thanks
Paul
--
To respond to this posting, remove -nospam- from my email address.
Sorry for the inconvenience
------------------------------
Date: Tue, 17 Oct 2000 12:43:51 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: converting a binary file to ascii
Message-Id: <Pine.LNX.4.21.0010171239030.26081-100000@hawk.ce.mediaone.net>
On Tue, 17 Oct 2000, Paul Spitalny quoth:
PS> Hi,
PS> I have a binary file, how can I convert it to ascii? I think I need to
PS> read in the file byte by byte but can't figure out how to do it. Any
PS> help appreceated!
use PSI::ESP;
perldoc -f read
perldoc -f pack
perldoc -f seek
perldoc -f unpack
and probably others,
anm
--
$ # = "%.6g" ; stat $0 or die $! ;
_ = q.Just another Perl Hacker. ;
print $ # ;
main'_ . v10 ;
------------------------------
Date: Tue, 17 Oct 2000 15:06:02 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: CPAN.pm gripe
Message-Id: <uVZG5.18927$YX4.672164@news2.giganews.com>
nospam@david-steuber.com wrote:
:
: Some modules do not work with CPAN.pm. One module that I wanted the
: other day, PDL (complete with TriD and OpenGLQ), would not install
: with CPAN. I was finally able to get it by fetching it the old
You should *always* be able to manually build/run any module that was
obtained by CPAN.pm by looking at the sources in
$CPAN::Config->{build_dir}/Module-Name-Version.
$ perl -MCPAN::Config -e 'print "@{[$CPAN::Config->{build_dir}]}\n";'
I've experienced the same build/test/install issues with Tk.pm.
Anything that has a gui-based test seems to require a manual execution
of the test and then a manual installation. Else, CPAN.pm doesn't know
when the gui-based test has completed and when it's time for
installation. Even if you exit the Tk.pm 'make test' from the widget,
this seems to terminate the build/test/install process.
(This may have changed over the last two months, but I doubt it.)
: fashioned way with FTP. I then found that there was a Perl file I had
: to edit to allow it to build. It did not use the ./configure, make,
: make test, make install mantra.
In other words, there's no sin if you download the modules (or bundles
of modules!) you need with CPAN.pm and then build them by hand. :-)
: Thanks for letting me vent, if I haven't been kill filed by this.
Why should someone killfile you for making a sensible posting? :-)
--
Nate II
------------------------------
Date: 17 Oct 2000 11:08:31 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Create a copy of a variable
Message-Id: <m3d7gzqwlc.fsf@dhcp11-177.support.tivoli.com>
Daniel Jones <ddjones@speakeasy.org> writes:
> This syntax:
>
> ${@$Instructors}[$i]
>
> was a bit tricky, but I got it.
Try this syntax instead:
$Instructors->[$i]
It's quite a bit less cumbersome.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 17 Oct 2000 16:11:03 GMT
From: consultas@gordos.com (Gordos.com)
Subject: ERROR
Message-Id: <39ec79c3.1045448215@news.videotron.ca>
I have this error runnung my script:
" [an error occurred while processing this directive]"
Is it possible it's related to path errors?
Thanks
juan
juancho22@gordos.com
------------------------------
Date: 17 Oct 2000 18:45:46 +0200
From: Calle Dybedahl <calle@lysator.liu.se>
Subject: Re: ERROR
Message-Id: <86bswj76x1.fsf@tezcatlipoca.algonet.se>
>>>>> "Gordos" == Gordos com <consultas@gordos.com> writes:
> I have this error runnung my script:
> " [an error occurred while processing this directive]"
> Is it possible it's related to path errors?
We've got a cat called Tusse.
--
Calle Dybedahl, Vasav. 82, S-177 52 Jaerfaella,SWEDEN | calle@lysator.liu.se
"I'd rather hang on to madness than normality" -- KaTe Bush
------------------------------
Date: Tue, 17 Oct 2000 10:06:19 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: ERROR
Message-Id: <39EC870B.F1B33449@stomp.stomp.tokyo>
Gordos.com wrote:
You have your Forte Agent setup incorrectly.
> I have this error runnung my script:
> " [an error occurred while processing this directive]"
> Is it possible it's related to path errors?
This error most commonly occurs with a Server
Side Include call. Note my use of 'commonly'.
There are three equally common causes of this
specific error message. A called script does
not exist or cannot be found, a called script
crashes for whatever reason and, a final reason,
Server Side Includes are not allowed for your
directory or your entire account but allowed
in general within a server.
Are you using Server Side Includes or calling
this script directly?
A logical approach would be to test your script
as a stand-alone to be sure it runs correctly,
then test your path statement in your SSI call.
If these tests fail and you are certain you have
all 'things' correct, then test your account
for Server Side Includes permission:
<html>
<!--#echo var="HTTP_USER_AGENT"-->
</html>
You should read your browser and system
type for this simple html page if Server
Side Includes are enabled for your account,
or a specific directory.
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: 17 Oct 2000 18:03:07 +0100
From: nobull@mail.com
Subject: Re: filtering with a script
Message-Id: <u9og0jxuwk.fsf@wcl-l.bham.ac.uk>
Cyrille <cyrille@ktaland.com> writes:
> test: "| /home/domain/www/work/procmail_inscription.pl" ,cyrille
> open( OUT, '>/home/domain/www/work/myout.txt');
Obvious (not Perl related) question: have you made
/home/domain/www/work/myout.txt writable by the user id under which
sendmail executes programs in the alias file?
Ob Perl: You should _always_ check the success of open()
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 17 Oct 2000 18:07:58 +0100
From: nobull@mail.com
Subject: Re: IO::Socket falls over under Perl 5.6.0
Message-Id: <u9itqrxuoh.fsf@wcl-l.bham.ac.uk>
Richard Lawrence <ralawrence@my-deja.com> writes:
> In article <slrn8ulk60.4tc.trammell@nitz.hep.umn.edu>,
> trammell@nitz.hep.umn.edu (John J. Trammell) wrote:
> > On Mon, 16 Oct 2000 16:54:14 GMT, Richard Lawrence
> > <ralawrence@my-deja.com> wrote:
> > >Consider this line:
> > >
> > > $socket = IO::Socket::INET->new( PeerAddr => $site,
> > > PeerPort => $port,
> > > Proto => "tcp",
> > > Type => SOCK_STREAM
> > > Timeout => 5 );
> > >
> > >under Perl 5 it worked fine.
> >
> > Wow, Perl knows how to insert missing commas? Who'da thunk it?
>
> Actually, although no-one is going to believe me, this code has been
> working fine (without the comma!) since the 23rd May 2000 and has had
> over 5000 executions.
>
> I've not touched it in the slightest until today to add the comma!!
The missing comma simply causes Timeout => 5 to be interpreted as
an argument list to SOCK_STREAM(). In 5.5 SOCK_STREAM() is
unprototyped and simply ignores arguments. In 5.6 it is explicitly
prototyped as having no arguments.
> Am i going mad?
Dunno, maybe.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 17 Oct 2000 15:54:46 GMT
From: jeacocks@uk.ibm.com
Subject: LockFile::Simple - using the PID information
Message-Id: <8shso6$qhc$1@sp4en10.hursley.ibm.com>
I am trying to use LockFile::Simple for file locking in a CGI script. When
LockFile::Simple locks a file, it creates another file with the PID of the
process that requested the lock in it. I would like a lockfile to be
considered stale if the PID no longer exists. Does anyone know how to do
this using this module or do you know of a module that can do this? I
cannot use FLOCK as the files I am trying to lock reside on an AFS
filesystem
Thanks for any help
Stewart
------------------------------
Date: 17 Oct 2000 16:05:09 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: LockFile::Simple - using the PID information
Message-Id: <slrn8uou5k.aeb.clay@panix2.panix.com>
On 17 Oct 2000 15:54:46 GMT, jeacocks@uk.ibm.com <jeacocks@uk.ibm.com> wrote:
>I am trying to use LockFile::Simple for file locking in a CGI script. When
>LockFile::Simple locks a file, it creates another file with the PID of the
>process that requested the lock in it. I would like a lockfile to be
>considered stale if the PID no longer exists. Does anyone know how to do
>this using this module or do you know of a module that can do this? I
>cannot use FLOCK as the files I am trying to lock reside on an AFS
>filesystem
Proc::ProcessTable may do the job for you:
NAME
Proc::ProcessTable - Perl extension to access the unix
process table
[...]
--
Clay Irving <clay@panix.com>
It's all fun and games,'till someone loses an eye! Then it's a *SPORT*
Marriage certificate is just another word for a work permit.
------------------------------
Date: Tue, 17 Oct 2000 10:22:45 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: Make this regex neater, anyone?
Message-Id: <Pine.LNX.4.21.0010171020230.26054-100000@hawk.ce.mediaone.net>
On Tue, 17 Oct 2000, Jeff Pinyan quoth:
JP> [posted & mailed]
JP>
JP> On Oct 17, Philip Lees said:
JP>
JP> >Hi. I have strings of the form
JP> >
JP> >IDT1PAT1ADM12ECG5
JP> >
JP> >and I need to extract the _last_ group of letters - ECG in the above
JP> >example. The regex also needs to handle the simplest case, i.e. IDT4
JP> >gives IDT.
JP>
JP> You can do:
JP>
JP> ($last) = $string =~ /(\D+)\d*$/;
JP> $last = scalar reverse (reverse($string) =~ /(\D+)/);
JP> [1] http://www.pobox.com/~japhy/sexeger/sexeger.html
Or, alternatively:
my $last = ( split '\d+', $string )[-1];
anm
--
$ # = "%.6g" ; stat $0 or die $! ;
_ = q.Just another Perl Hacker. ;
print $ # ;
main'_ . v10 ;
------------------------------
Date: Tue, 17 Oct 2000 17:23:14 +0100
From: "Richard" <mkt@bphltd.demon.co.uk>
Subject: Re: Maximum file size?
Message-Id: <uZ_G5.76$Ms3.3868@stones>
> Split your data base into twenty-six data files
> based upon the first letter of a member's last
> name then open a correct data file based upon
> a match for the first letter of a last name.
> Be careful about uppercase / lowercase sensitivity
> and incorrect input such as number instead of a
> letter for the first character of a last name.
>
>
>
> @Members = (A .. Z);
> foreach $member (@Members)
> {
> if ($member_last_name =~ /^$member/)
> open (MEMBER, "/your/path/to/$member.dat"); #optional error check
>
> .. do whatever
> }
>
>
>
> Godzilla!
> --
> Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
> UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
> BumScrew, South of Egypt ¦ HTML Programming Class
Though this works there are more common letters for first names which means
some files are little used.
A better way is to create, say, 30 files and use a hash algorithm to put
each name in the correct file.
Example of hash algorithm:
add the ASCII values of each character the members name together
find the remainder when divided by 30
use the remainder to point to correct file (file0 to file29)
This would create 30 files with members details more evenly distributed
Chard :)
------------------------------
Date: Tue, 17 Oct 2000 09:58:53 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Maximum file size?
Message-Id: <39EC854D.460315C6@vpservices.com>
Rafael Garcia-Suarez wrote:
>
> Neb wrote in comp.lang.perl.misc:
> >Hi,
> >
> >I have a web site where I store all my members in a flat file (no DB).
> >Everytime a new user become a member, I add his information in the file by
> >reading all the file content in memory, make sure he doesn't exist yet, and
> >then store all content back on disk. When the user logs in, I read all file
> >in memory, and make sure he is a real member. So far, the file size is of
> >90 KB and the time to read in memory and write on disk the file content is
> >fast.
> >
> >My question: is there a maximum size where I will start to see some problems
> >using this method? Is 1 Meg file size start to be a problem ?
>
> This is not a good idea to store such data in files. 90 kB is large
> enough and you should upgrade now to a DB.
There are other reasons to move from flat files to a full database, but
speed, on a 90 kb file is not one of them. DBD::RAM and DBD::CSV can
select through a 10,000 record flat file of 2.5 megabytes at a rate of
about 1 second per megabyte. In the time it would take them to parse a
90 kb file, you probably couldn't even make a connection to a real
database.
--
Jeff
------------------------------
Date: Tue, 17 Oct 2000 16:03:48 +0100
From: "Mike Dorrel" <mdorrel@fsnet.co.uk>
Subject: Re: MS Access
Message-Id: <39ec71b9.0@energise.enta.net>
must be pretty heavy **** o_!__||
"hartley_h" <hartleh1@westat.com> wrote in message
news:39EC6332.4F2C187D@westat.com...
> c_glensmith@my-deja.com wrote:
> >
> > I am stuck with Access because that is what the company uses and
> > database already exists.
>
> It is definitely worth your while to learn the limitations anyway. You
> should also seriously consider letting your boss know what those
> limitations are (in as much detail as possible and in writing) so that
> when it hits the fan, you aren't killed in the crossfire (to mix
> metaphors).
>
> --
> Henry Hartley
------------------------------
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 4642
**************************************