[23257] in Perl-Users-Digest
Perl-Users Digest, Issue: 5477 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 10 11:05:43 2003
Date: Wed, 10 Sep 2003 08:05:11 -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 Wed, 10 Sep 2003 Volume: 10 Number: 5477
Today's topics:
Re: $# is deprecated, $OFMT doesn't work <tassilo.parseval@rwth-aachen.de>
Re: $# is deprecated, $OFMT doesn't work (Anno Siegel)
Re: $# is deprecated, $OFMT doesn't work <steven.smolinski@sympatico.ca>
Best ways of using a username & password? <gary@abertron.co.uk>
Re: Best ways of using a username & password? <asu1@c-o-r-n-e-l-l.edu>
Re: Best ways of using a username & password? <gary@abertron.co.uk>
Re: Converting C++ to Perl (Kenny McCarty)
Re: Converting C++ to Perl <kalinabears@iinet.net.au>
Re: Creating a DSN-less connection to a MySQL database <al@bat400.com>
Re: Extra carriage returns - why? <me@privacy.net>
Re: Help me beef up my cruddy program <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Help me beef up my cruddy program (Helgi Briem)
Re: how should i fix this?? <trammell+usenet@hypersloth.invalid>
Re: illegal seek <flavell@mail.cern.ch>
Re: illegal seek (Anno Siegel)
Re: illegal seek <flavell@mail.cern.ch>
Re: looping every x seconds (Randal L. Schwartz)
Net::Telnet::Cisco->enable always return 1 (Bhaskar Kurapati)
Re: perl simple cms <andrew@NOSPAM_andicrook.demon.co.uk>
Re: Perl system() command failing under CYGWIN (Helgi Briem)
Re: Perl vs TCL (Chris Marshall)
Re: Perl/IIS Permission Problem (Helgi Briem)
Printing a hash of hashes using an array for the headin <mothra@nowhereatall.com>
Re: Reading Data File Records (Anno Siegel)
Slice an array of hashes? (Graham)
Re: Speeding up LWP::Simple (Randal L. Schwartz)
Re: Speeding up LWP::Simple <postmaster@castleamber.com>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Sep 2003 10:09:54 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <bjmt9i$n4g$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Anno Siegel:
> Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:
>
> [how to prepare a perl patch]
>
>> diff -u pod/perlvar.pod~ pod/perlvar.pod > patch
>>
>> and send the patch as attachment to perl5-porters@perl.org while
>
> Minor correction: Simply append the patch to the mail. Sending it
> as an attachment actually makes it harder for the receiver, since
> the patch program can deal directly with a mail message that ends
> with a patch.
That might be the best solution assuming you have a decent mailer. The
indecent ones are likely to render the patch unsubmittable by
introducing bogus line-breaks or such. Porting/patching.pod states:
Submitting your patch
Mailers
Please, please, please (get the point? 8-) don't use a mailer that
word wraps your patch. This leaves the patch essentially worthless
to the maintainers.
Unfortunately many mailers word wrap the main text of messages, but
luckily you can usually send your patches as email attachments
without them getting "helpfully" word wrapped.
I don't think my MUA is one of the evil ones, but the above somehow made
me cautious enough to always use attachments. I am a careful person. :-)
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 10 Sep 2003 10:28:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <bjmucg$2ce$5@mamenchi.zrz.TU-Berlin.DE>
Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:
> Also sprach Anno Siegel:
>
> > Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in
> comp.lang.perl.misc:
> >
> > [how to prepare a perl patch]
> >
> >> diff -u pod/perlvar.pod~ pod/perlvar.pod > patch
> >>
> >> and send the patch as attachment to perl5-porters@perl.org while
> >
> > Minor correction: Simply append the patch to the mail. Sending it
> > as an attachment actually makes it harder for the receiver, since
> > the patch program can deal directly with a mail message that ends
> > with a patch.
>
> That might be the best solution assuming you have a decent mailer. The
> indecent ones are likely to render the patch unsubmittable by
> introducing bogus line-breaks or such. Porting/patching.pod states:
That is indeed another aspect. Don't patch sources with long lines :)
> Submitting your patch
> Mailers
> Please, please, please (get the point? 8-) don't use a mailer that
> word wraps your patch. This leaves the patch essentially worthless
> to the maintainers.
>
> Unfortunately many mailers word wrap the main text of messages, but
> luckily you can usually send your patches as email attachments
> without them getting "helpfully" word wrapped.
>
> I don't think my MUA is one of the evil ones, but the above somehow made
> me cautious enough to always use attachments. I am a careful person. :-)
I did that too (send attachments), until someone (Hugo?) asked me not to.
When sending a patch from somewhere I haven't done it before, I mail it
to myself and see if it arrives in good shape.
Anno
------------------------------
Date: Wed, 10 Sep 2003 13:41:06 GMT
From: Steven Smolinski <steven.smolinski@sympatico.ca>
Subject: Re: $# is deprecated, $OFMT doesn't work
Message-Id: <SRF7b.3183$z5.247574@news20.bellglobal.com>
Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote:
> Also sprach Steven Smolinski:
>> I don't know how to submit a documentation patch to p5p, but I
>> suppose I can learn.
>
> perlvar.pod is just a plain file in the Perl source tree so you'd patch
> it as any other file. See 'perldoc perlhack' for an instruction on how
> to patch Perl and submit those patches.
> [...]
Thanks for the primer. Next time I won't let Abigail beat me to it.
Steve
--
Steven Smolinski => http://arbiter.ca/
GnuPG Public Key => http://arbiter.ca/steves_public_key.txt
=> or email me with 'auto-key' in the subject.
Key Fingerprint => 08C8 6481 3A7B 2A1C 7C26 A5FC 1A1B 66AB F637 495D
------------------------------
Date: Wed, 10 Sep 2003 13:05:27 +0100
From: Gary Mayor <gary@abertron.co.uk>
Subject: Best ways of using a username & password?
Message-Id: <cmE7b.123$eW.193317@newsfep1-win.server.ntli.net>
Hi,
I'm placing a username and password form on my site but can't decide on
the best way to do it. I've looked at
Apache Session ID
Encrypted cookies
and a couple of other things that are crap. What's the best method of
doing it. I need them to enter a username and password and I need the
site to remember there using it and timeout after 20 minutes of inactivity.
Is there an industry standard for doing this?
Help
Thanks
Gary Mayor
------------------------------
Date: 10 Sep 2003 14:12:27 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Best ways of using a username & password?
Message-Id: <Xns93F267D6AE532asu1cornelledu@132.236.56.8>
Gary Mayor <gary@abertron.co.uk> wrote in
news:cmE7b.123$eW.193317@newsfep1-win.server.ntli.net:
> Hi,
> I'm placing a username and password form on my site but can't decide
> on the best way to do it. I've looked at
> Apache Session ID
> Encrypted cookies
> and a couple of other things that are crap. What's the best method of
> doing it. I need them to enter a username and password and I need the
> site to remember there using it and timeout after 20 minutes of
> inactivity. Is there an industry standard for doing this?
None of this is topical for this group. Try
comp.inforsystems.www.authoring.cgi for general questions, and find the
appropriate group for your server for server-specific questions.
You may want to consult the WWW Security FAQ
(http://www.w3.org/Security/Faq/www-security-faq.html) and the Login
Tutorial (http://www.webthing.com/tutorials/LOGIN1.html).
Sinan.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Wed, 10 Sep 2003 15:50:36 +0100
From: Gary Mayor <gary@abertron.co.uk>
Subject: Re: Best ways of using a username & password?
Message-Id: <2NG7b.983$lj5.564143@newsfep2-win.server.ntli.net>
A. Sinan Unur wrote:
> Gary Mayor <gary@abertron.co.uk> wrote in
> news:cmE7b.123$eW.193317@newsfep1-win.server.ntli.net:
>
>
>>Hi,
>>I'm placing a username and password form on my site but can't decide
>>on the best way to do it. I've looked at
>>Apache Session ID
>>Encrypted cookies
>>and a couple of other things that are crap. What's the best method of
>>doing it. I need them to enter a username and password and I need the
>>site to remember there using it and timeout after 20 minutes of
>>inactivity. Is there an industry standard for doing this?
>
>
> None of this is topical for this group. Try
> comp.inforsystems.www.authoring.cgi for general questions, and find the
> appropriate group for your server for server-specific questions.
>
> You may want to consult the WWW Security FAQ
> (http://www.w3.org/Security/Faq/www-security-faq.html) and the Login
> Tutorial (http://www.webthing.com/tutorials/LOGIN1.html).
>
> Sinan.
>
How can this be in the wrong group. This is a Perl Misc group and most
of the people on here will have there own methods of using passwords. My
topic is about perl I wasn't asking about any other language.
Miscellaneous means anything relating to Perl right so why the hell is
this in the wrong group. If people spent less time moaning and more
doing this world would be a better place.
But thanks for the last url that helped.
------------------------------
Date: 10 Sep 2003 04:14:38 -0700
From: kenny@barmeister.com (Kenny McCarty)
Subject: Re: Converting C++ to Perl
Message-Id: <589a1080.0309100314.4254698f@posting.google.com>
Sisyphus <kalinabears@iinet.net.au> wrote in message news:<3f5ec426$0$23610$5a62ac22@freenews.iinet.net.au>...
> Kenny McCarty wrote:
>
> >
> > The C++ is run on Windows XP and the perl is run on Free-BSD. For the
> > perl part I want the user to input the volume serial number of their C
> > drive and I want to create a strign using this data. I think that the
> > conversions are different between windows and unix and that is where
> > my problem is but I am not sure. In windows the "3" becomes a "056"
> > but in unix it becomes a "53". Any help would be apprecieated.
> > Thanks.
>
> Are you sure about this ?
> Both 'C' and 'perl' report an ASCII value of 51 for '3' (on both Linux
> and Windows) for me - which is as I would expect. (Your perl script
> outputs '51-48-51'.)
>
> Hth.
>
> Cheers,
> Rob
Yes I am sure....however I am not sure if the C code is actually
outputting the ascii values or something else...therein lies my
dilema. I am VERY rusty with C coding and I am trying to convert this
to perl from someone else's C code. So maybe someone who is familiar
with C and perl can figure this out :-)
------------------------------
Date: Thu, 11 Sep 2003 00:35:00 +1000
From: Sisyphus <kalinabears@iinet.net.au>
Subject: Re: Converting C++ to Perl
Message-Id: <3f5f3742$0$23599$5a62ac22@freenews.iinet.net.au>
Kenny McCarty wrote:
>>
>>Are you sure about this ?
>>Both 'C' and 'perl' report an ASCII value of 51 for '3' (on both Linux
>>and Windows) for me - which is as I would expect. (Your perl script
>>outputs '51-48-51'.)
>>
>>Hth.
>>
>>Cheers,
>>Rob
>
>
> Yes I am sure....however I am not sure if the C code is actually
> outputting the ascii values or something else...therein lies my
> dilema. I am VERY rusty with C coding and I am trying to convert this
> to perl from someone else's C code. So maybe someone who is familiar
> with C and perl can figure this out :-)
Not sure where to go from here. Did John Krahn's post shed any light on
the problem for you ?
Does it help to know that the serial number can be parsed from the
output of the 'dir' windows system command (so long as it's run in the
appropriate drive, of course) ?
eg the following (transcribed) code works for me on Win2k, though ymmv
on different windows boxes.
my $d = `dir`;
my @stuff = split /\n/, $d;
$stuff[1] =~ s/ Volume Serial Number is //i;
print $stuff[1]; # prints serial number of current drive.
Cheers,
Rob
------------------------------
Date: Wed, 10 Sep 2003 14:04:46 +0100
From: "Al Reynolds" <al@bat400.com>
Subject: Re: Creating a DSN-less connection to a MySQL database
Message-Id: <bjn7n4$et28p$1@athena.ex.ac.uk>
"James Willmore" <jwillmore@cyberia.com> wrote in message
news:20030909123830.2ce6ab2f.jwillmore@cyberia.com...
> On Tue, 9 Sep 2003 13:37:09 +0100
> "Al Reynolds" <al@bat400.com> wrote:
> > I hope someone will be able to help me with this.
> >
> > I am trying to set up a connection to my MySQL
> > database using perl. I already have the database
> > set up and have used it with PHP without any problems.
> >
> > When I try and execute the following code, I get an error:
> > (obviously I have substituted the names/passwords)
> >
> > #!/usr/bin/perl
> > use DBI;
> > my $dbh =
> > DBI->connect('DBI:mysql:databasename:localhost','username','passwor
> > d');$dbh->disconnect or warn "Disconnection error: $DBI::errstr\n";
> > exit;
>
> Try to first, read the documentation for DBD::mysql and second, try to
> connect using ...
>
> DBI->connect('DBI:mysql:database=dbname;host=localhost',
> 'username',
> 'password')
> or die "Connection error: ".$DBI::errstr."\n";
>
> If you had read the documentation, you would have discovered that your
> connection statement is wrong.
I read enough to decide that the using DBI would
generate a DSN connection*, which wasn't what I
wanted, which is why I gave up on the DBI route
to pursue the ADODB route. The code I used is
referred to in several perl-related resources and
tutorials on different web sites; I doubt that they
all made the same mistake. It isn't that uncommon
for a call to be possible in a variety of forms.
Anyway, thank you for the code snippet. If I am
trying to make a DBI connection again I will use it.
FWIW, I solved the problem using the older
mysql.pm module, which is less portable when
there is a possibility that the database type could
change later. It works fine just now though.
Cheers,
Al
* This may be wrong of course - I am still not quite clear
on the matter. There is surprisingly little info online about
the difference between DSN and DSN-less database
connections and how to set them up using perl.
------------------------------
Date: Wed, 10 Sep 2003 23:35:45 +1200
From: "Tintin" <me@privacy.net>
Subject: Re: Extra carriage returns - why?
Message-Id: <bjn27u$ki801$1@ID-172104.news.uni-berlin.de>
"John Andrews" <john.andrews1@talk21.com> wrote in message
news:fc134cb0.0308290528.5a678e0e@posting.google.com...
> Running perl, v5.6.1 (built for cygwin-multi) on Win2000
Very nice, but what was your question?
Actually, that was a retorical question, as I've deduced that you asked your
question in your original post, but as that has expired on my newserver, I
can not see it, hence the reason that you should properly quote yourself if
you are following up to a post.
Have you read the posting guidelines for this group and read any tutorials
on using newgroups in general?
------------------------------
Date: Wed, 10 Sep 2003 10:12:45 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Help me beef up my cruddy program
Message-Id: <Xns93F27C268522Celhber1lidotechnet@62.89.127.66>
Eric J. Roode wrote:
> Dan Jacobson <jidanni@jidanni.org> wrote in
> news:8765k1qkti.fsf@jidanni.org:
>
>> Help me beef up my cruddy program. It should then even run on
>> Microsoft, by the way.
>
> What's wrong with it?
It's lacking in beef, according to the Subject.
--
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Wed, 10 Sep 2003 13:24:28 GMT
From: f_baggins80@hotmail.com (Helgi Briem)
Subject: Re: Help me beef up my cruddy program
Message-Id: <3f5f25fd.423620554@News.CIS.DFN.DE>
On Wed, 10 Sep 2003 10:12:45 +0000 (UTC), "Bernard El-Hagin"
<bernard.el-hagin@DODGE_THISlido-tech.net> wrote:
>Eric J. Roode wrote:
>
>> Dan Jacobson <jidanni@jidanni.org> wrote in
>> news:8765k1qkti.fsf@jidanni.org:
>>
>>> Help me beef up my cruddy program. It should then even run on
>>> Microsoft, by the way.
>>
>> What's wrong with it?
>
>
>It's lacking in beef, according to the Subject.
$beef++;
------------------------------
Date: Wed, 10 Sep 2003 13:52:43 +0000 (UTC)
From: "John J. Trammell" <trammell+usenet@hypersloth.invalid>
Subject: Re: how should i fix this??
Message-Id: <slrnblub5b.qpi.trammell+usenet@hypersloth.el-swifto.com.invalid>
On 9 Sep 2003 18:27:45 -0700, jend <dejen321@yahoo.com> wrote:
> my @thoseLabels = qw(Tom's John's Jim's mike blah bloh);
>
> my $this_array = "'".join("','", map { $_ =~ /\'/ ? $_ =~ s/\'/\\'/g
>: $_ } @thoseLabels)."'";
>
> print $this_array;
>
>>> '1','1','1','mike','blah','bloh'
>
> However I want it to come out like this:
>
>>> 'Tom\'s','John\'s','Jim\'s','mike','blah','bloh'
>
>
> is it possible to rewrite this one liner to do this?
> any tips would be greatly appreciated!!
>
[untested]
my @thoseLabels = qw(Tom's John's Jim's mike blah bloh);
my $this_array = join ",", map "'$_'", map { s/'/\\'/; $_ } @thoselabels;
------------------------------
Date: Wed, 10 Sep 2003 12:12:02 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: illegal seek
Message-Id: <Pine.LNX.4.53.0309101159260.22036@lxplus068.cern.ch>
On Wed, Sep 10, Anno Siegel inscribed on the eternal scroll:
> <chris-usenet@roaima.co.uk> wrote in comp.lang.perl.misc:
> > The issue here (as far as I'm concerned) is that flock *appears* to let
> > you upgrade atomically but it doesn't really do so. Can this warning be
> > added explicitly to perldoc for flock?
>
> This doesn't belong in perldoc -- it depends on the underlying OS and
> isn't a property of Perl.
With respect, that's an over-purist approach to documentation. As
we've seen in discussion, this was a very tempting approach that some
programmers believe in good faith is feasible: at the very least, the
Perl documentation which the Perl programmer is supposed to consult
should draw attention to the potential issue, and direct them to look
at the portability documentation, where they should then be able to
find relevant details for their particular OS.
But anyone with an eye to portable programming (and this _is_ one of
Perl's strengths, after all) should be able to select a portable
programming technique without being forced to trawl through the
portability documentation for umpteen OSes with which they're
otherwise totally unfamiliar. Am I being unreasonable?
> The documentation of all system calls in
> Perl must be read in conjunction with the man page of that call.
Sorry, but I stand by my point. Someone amongst the perlporters is in
a position to know about the OSes that are unfamiliar to me as a
programmer: I want to be able to select a portable programming
technique "at the point of service", i.e in this case starting out
from Perl's own documentation relating to file locking, based on their
advice, without having to do my own research on numerous unfamiliar
OSes. Whether it's from perldoc -f flock, or from perlopentut, or
from the relevant FAQ, in a practical sense I want to be directed to
any specific caveats that I need. Telling me to read the man pages
for umpteen OSes that I don't have and am completely unfamiliar with
does not answer that requirement, do you see what I mean?
best regards
------------------------------
Date: 10 Sep 2003 12:38:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: illegal seek
Message-Id: <bjn60o$bd7$1@mamenchi.zrz.TU-Berlin.DE>
Alan J. Flavell <flavell@mail.cern.ch> wrote in comp.lang.perl.misc:
> On Wed, Sep 10, Anno Siegel inscribed on the eternal scroll:
>
> > <chris-usenet@roaima.co.uk> wrote in comp.lang.perl.misc:
>
> > > The issue here (as far as I'm concerned) is that flock *appears* to let
> > > you upgrade atomically but it doesn't really do so. Can this warning be
> > > added explicitly to perldoc for flock?
> >
> > This doesn't belong in perldoc -- it depends on the underlying OS and
> > isn't a property of Perl.
>
> With respect, that's an over-purist approach to documentation. As
> we've seen in discussion, this was a very tempting approach that some
> programmers believe in good faith is feasible: at the very least, the
> Perl documentation which the Perl programmer is supposed to consult
> should draw attention to the potential issue, and direct them to look
> at the portability documentation, where they should then be able to
> find relevant details for their particular OS.
>
> But anyone with an eye to portable programming (and this _is_ one of
> Perl's strengths, after all) should be able to select a portable
> programming technique without being forced to trawl through the
> portability documentation for umpteen OSes with which they're
> otherwise totally unfamiliar. Am I being unreasonable?
Unreasonable, you? You must be kidding! You are a rock of reason
in the sea of Usenet.
> > The documentation of all system calls in
> > Perl must be read in conjunction with the man page of that call.
>
> Sorry, but I stand by my point.
It is, however, how the Perl documentation proper deals with system
calls. "perldoc -f exec" basically points you at the man pages for
execvp(3) and sh(1), which must be frustrating when your system has
neither. The get* chapters do the same, quite summarily.
> Someone amongst the perlporters is in
> a position to know about the OSes that are unfamiliar to me as a
> programmer: I want to be able to select a portable programming
> technique "at the point of service", i.e in this case starting out
> from Perl's own documentation relating to file locking, based on their
> advice, without having to do my own research on numerous unfamiliar
> OSes. Whether it's from perldoc -f flock, or from perlopentut, or
> from the relevant FAQ, in a practical sense I want to be directed to
> any specific caveats that I need. Telling me to read the man pages
> for umpteen OSes that I don't have and am completely unfamiliar with
> does not answer that requirement, do you see what I mean?
Oh, I do see what you mean. File locking is one of the functions that
suffer most from portability issues. A nice matrix that shows flock()
features against Perl ports would be a meritorious project, but someone
has to do it, and maintain it.
At the moment, I'd stick to the most elementary locking methods if
portability is an issue. It doesn't pay to cut corners, even if it
"works" on one system. A false sense of security may be the result.
If that it unbearably slow for some reason, I'd try to optimize it
for the system(s) it is running on, turning to the relevant basic
man pages.
Anno
------------------------------
Date: Wed, 10 Sep 2003 15:08:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: illegal seek
Message-Id: <Pine.LNX.4.53.0309101450400.22036@lxplus068.cern.ch>
On Wed, Sep 10, Anno Siegel inscribed on the eternal scroll:
> > > <chris-usenet@roaima.co.uk> wrote in comp.lang.perl.misc:
> >
> > > > The issue here (as far as I'm concerned) is that flock *appears* to let
> > > > you upgrade atomically but it doesn't really do so. Can this warning be
> > > > added explicitly to perldoc for flock?
> > >
> > > This doesn't belong in perldoc -- it depends on the underlying OS and
> > > isn't a property of Perl.
> >
> > With respect, that's an over-purist approach to documentation.
[...]
> > OSes. Whether it's from perldoc -f flock, or from perlopentut, or
> > from the relevant FAQ, in a practical sense I want to be directed to
> > any specific caveats that I need. Telling me to read the man pages
> > for umpteen OSes that I don't have and am completely unfamiliar with
> > does not answer that requirement, do you see what I mean?
>
> Oh, I do see what you mean. File locking is one of the functions that
> suffer most from portability issues. A nice matrix that shows flock()
> features against Perl ports would be a meritorious project, but someone
> has to do it, and maintain it.
Well, for the moment I second Chris's proposal, since, as you imply,
a more thoroughgoing answer may be too much to ask for.
I've looked again at the (5.8.0) documentation to get an idea where
that might best fit. perldoc -f flock already has a cluster of
Note:... and Note also:... paragraphs, it might do no harm to add
another one there, but on balance I think the file locking section of
perlopentut might be a preferable place for it. I've looked at
perlport and concluded that's not the right place. Naturally one
should look at the latest code version rather than 5.8.0 before
finalising the draft.
I'm thinking of something along the lines of
__
/
One can NOT in general expect to upgrade a shared file lock to an
exclusive lock in an atomic fashion: an "upgrade" would involve
releasing the shared lock (at which point another process could get
the lock) before the exclusive lock can be taken. Therefore, if you
will ultimately need the exclusive lock, e.g for updating the file
based on its previously-read content, you will need to take it from
the outset.
\___
Can it be said shorter - more accurately? Hatchets out...
all the best
------------------------------
Date: Wed, 10 Sep 2003 14:17:32 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: kernal32 <surakshan@Yahoo.com>
Subject: Re: looping every x seconds
Message-Id: <f3ceed9f97300fb678ba6c245e61e4da@news.teranews.com>
>>>>> "kernal32" == kernal32 <surakshan@removethisYahooRemove.com> writes:
kernal32> I'm using sleep 5 to wait 5 second before executing some
kernal32> code.
kernal32> my question is, how can I keep the rest of the program
kernal32> running whilst the loop continues in pararel
A simple way is to insert a check into your main loop:
my $next_time = time + 5;
while (1) {
if (time > $next_time) {
... do your once every five seconds thing here ..
$next_time = time + 5;
}
... rest of code ...
}
If other things are event-driven, consider POE, found in the CPAN,
and described at http://poe.perl.org/.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 10 Sep 2003 04:30:38 -0700
From: bhas_kurapati@yahoo.com (Bhaskar Kurapati)
Subject: Net::Telnet::Cisco->enable always return 1
Message-Id: <3c0c6539.0309100330.47160e4f@posting.google.com>
Hi,
I am using Net::Telnet::Cisco module to add some rules in CMTS(Cisco
Router) ... when I am entering enable mode ...
"$session->enable("enable_password")" (see code below) always returns
"1" even when password is wrong. According to Net::Telnet::Cisco
module documentation it should return "1" on success and undefined
when password is wrong or can not enter enable mode.
use Net::Telnet::Cisco;
my($session, $ok, @output);
$session = Net::Telnet::Cisco->new(Host => '123.123.123.123');
$session->login('login', 'password');
# Enable mode
$ok = $session->enable("xxxxxxx");
print "$ok"; # This line always pring "1" even when enable password
is wrong
if ($ok) {
@output = $session->cmd('show privilege');
print "My privileges: @output\n";
} else {
# this loop is never executed even when enable password is wrong
warn "Can't enable: " . $session->errmsg;
}
$session->close;
What might be the problem here ???
thanks in advance
Bhaskar Kurapati
------------------------------
Date: Wed, 10 Sep 2003 15:49:15 +0100
From: "Andrew Crook" <andrew@NOSPAM_andicrook.demon.co.uk>
Subject: Re: perl simple cms
Message-Id: <bjndk8$68i$1$830fa795@news.demon.co.uk>
yes I have this covered ciding wise, its how I should store the page
contents in a mysql database
how I should store paragraphs, images, links ,etc for pages and the web site
as a whole i.e. design the database structure around a cms
many thanks
Andrew
"Ted Zlatanov" <tzz@lifelogs.com> wrote in message
news:4nn0dd51ub.fsf@lockgroove.bwh.harvard.edu...
> On Mon, 8 Sep 2003, andrew@nospam_andicrook.demon.co.uk wrote:
>
> > can any of you recommend how I should go about storing the
> > information in a mysql database (database structure). Just need a
> > few ideas to work from
>
> Use the Class::DBI module to get and store data in a MySQL database
> (it handles other RDBMSs too).
>
> http://search.cpan.org/author/TMTM/Class-DBI/lib/Class/DBI.pm
>
> Ted
------------------------------
Date: Wed, 10 Sep 2003 13:08:36 GMT
From: f_baggins80@hotmail.com (Helgi Briem)
Subject: Re: Perl system() command failing under CYGWIN
Message-Id: <3f5f2070.422199701@News.CIS.DFN.DE>
On 10 Sep 2003 01:19:21 -0700, gordonp@myrealbox.com (Gordon) wrote:
>The following script run from the CYGWIN prompt (on the same PC),
>prints 'ls[return]' but fails to execute the 'system ("ls") command;
>no error is displayed it just skips over the system() line:
>!#g:/perl/bin
>print "ls\n";
>system("ls");
No, it works fine. Oh, you wanted to see the output?
Then you don't want to use the system function,
you want to use backticks or qx as specified in the
perlFAQ:
perlfaq -q "Why can't I get the output of a command with system()?"
If your cygwin directory is not in path, you may need
to supply the full path to ls. You will definitely have
to do that if this is supposed to run as a CGI.
You should also ALWAYS check external and
system calls for errors with warn or die as appropriate!
my $ls = 'C:/cygwin/bin/ls.exe';
my $output = qx/$ls/ or die "Cannot run $ls:$!\n";
print $output;
>Perl & Cygwin are supplied with the software, so I am hesitant to
>upgrade them. Perl is v5.005_002.
Ancient. Do yourself a favour and upgrade.
>I have tried the usual Google and mailing list archive searches with
>no luck. So, any suggestions are much appreciated.
perldoc comes first, Google later.
------------------------------
Date: 10 Sep 2003 05:07:26 -0700
From: c_j_marshall@hotmail.com (Chris Marshall)
Subject: Re: Perl vs TCL
Message-Id: <cb9c7b76.0309100407.558d427f@posting.google.com>
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message news:<Xns93F1A965361Bsdn.comcast@206.127.4.25>...
> James Willmore <jwillmore@cyberia.com> wrote in
> news:20030909123749.0cfa013b.jwillmore@cyberia.com:
>
> >
> > Each language has its strengths and its weaknesses.
> >
>
> What are Befunge's strengths? ;-)
How about ZT ?
http://www.winterbergs.de/software/zt.txt
which I found here: http://www.kraml.at/stupid/languages.html
------------------------------
Date: Wed, 10 Sep 2003 12:09:26 GMT
From: f_baggins80@hotmail.com (Helgi Briem)
Subject: Re: Perl/IIS Permission Problem
Message-Id: <3f5f1195.418397173@News.CIS.DFN.DE>
On 9 Sep 2003 14:46:29 -0700, freemans@intellicominc.com (Shane
Freeman) wrote:
>I am having a horrible time getting the permissions set correctly
>using ActivePerl and IIS 5.0. Any help would be greatly appreciated!
Your Question is Frequently Asked. Answers to Freqently
Asked Questions are to be found in the perlFAQ documentation
that comes bundled with every distribution of Perl. It can
be browsed and searched using the perldoc program that
also comes with every distribution of Perl. The command
perldoc perldoc for more info. The Activeperl distro also
comes with the docs in HTML format in C:\Perl\html\index.html
perldoc -q 500
"My CGI script runs from the command line but not the browser.
(500 Server Error)
>Can't open perl script "c:\websites\www.mysite.com\cms\test.cgi":
>Permission denied
>Can anybody shed any light on this problem?
The most likely reason is that the IIS webserver runs
as an anonymous user with less rights than a normal
user such as yourself. This is good. You have to
explicitly permit this user (used to be called IUSR_servername)
to read and execute the CGI program.
Further, this question is off-topic in this newsgroup
and should be addressed to a group about web server
configuration or CGI such as:
comp.infosystems.www.servers.ms-windows
comp.infosystems.www.authoring.cgi
------------------------------
Date: Wed, 10 Sep 2003 06:55:08 -0700
From: "Mothra" <mothra@nowhereatall.com>
Subject: Printing a hash of hashes using an array for the headings and getting the columns to line up
Message-Id: <3f5f2cda$1@usenet.ugs.com>
Hi All,
I am trying to print out a report using a Hash of Hashes and am having
trouble
getting the columns to print out correctly. I have an array that contains
the column
headings in the correct order but I am stuck as how to get the HoH to use
this information. I have provided a test script as to what I have tried.
How can I get the script to print the columns in the correct order.
Thanks
Mothra
#!/app/perl5.8.0/bin/perl
use strict;
use warnings;
my @family = qw(UNIGRAPHICS_NX UNIGRAPHICS SOLID_EDGE WEBTOOLS other);
my %people = (
'wattsl' => {
'SOLID_EDGE' => 3,
'WEBTOOLS' => 10,
'UNIGRAPHICS' => 19,
'UNIGRAPHICS_NX' => 57
},
'friasd' => {
'other' => 2,
'SOLID_EDGE' => 10,
'WEBTOOLS' => 25,
'UNIGRAPHICS' => 21,
'UNIGRAPHICS_NX' => 81
},
'yamaguch' => {
'other' => 4,
'SOLID_EDGE' => 12,
'WEBTOOLS' => 11,
'UNIGRAPHICS' => 9,
'UNIGRAPHICS_NX' => 56
},
'jung' => {
'other' => 2,
'SOLID_EDGE' => 5,
'WEBTOOLS' => 16,
'UNIGRAPHICS' => 13,
'UNIGRAPHICS_NX' => 39
},
'riches' => {
'other' => 2,
'SOLID_EDGE' => 18,
'WEBTOOLS' => 24,
'UNIGRAPHICS' => 10,
'UNIGRAPHICS_NX' => 83
},
);
printf "%24s %10s %10s %8s %5s \n", @family;
foreach my $person( sort keys %people ) {
printf "%9s %2d %2d %2d %2d %2d\n", $person,
map { $people{$person}{$_} } sort keys %{ $people{$person} };
}
------------------------------
Date: 10 Sep 2003 13:15:26 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reading Data File Records
Message-Id: <bjn85e$cpk$1@mamenchi.zrz.TU-Berlin.DE>
Jay Tilton <tiltonj@erols.com> wrote in comp.lang.perl.misc:
> GrahamWilsonCA@yahoo.ca (Graham) wrote:
> : The file is generated using about five lines of FORTRAN so it seems
> : somehwat surprising that I am up to 30 lines of perl with almost no
> : end in sight...
>
> Why should that be surprising? You're trying to build a modicum of
> intelligence into one tool to compensate for another's lack of
> sophistication. The Perl program would have a much easier time reading
> if the FORTRAN program was only a little better at writing.
Also, parsing input is generally harder than generating output. Printing
what comes along is easy. To read it back in, you must often (as in
the OPs case) understand what you have read so far to know how to
proceed.
The C functions printf() and scanf() are an attempt to make printing
and scanning symmetric. A look at their respective frequency of use
shows that the attempt wasn't a full success.
Anno
------------------------------
Date: 10 Sep 2003 07:45:32 -0700
From: GrahamWilsonCA@yahoo.ca (Graham)
Subject: Slice an array of hashes?
Message-Id: <eda30d78.0309100645.64745eb2@posting.google.com>
Is it possible to slice a list of hashes?
I read in data into the @data array as follows:
while ( $i < $numLev )
{
$line = <$fh>; # Take
next line
$line =~ s/^\s+|\s+$//g; # Strip
whitespace
$line =~ s/,/ /g; #
Replace commas
@prf = ( @prf, (split /\s+/, $line) ); # Get the data
$i = $#prf + 1; # Update
total
}
@data = (@data, {"id"=>$id, "units"=>$units,
"data"=>[@prf]});
}
I want to find all the indices of atm where $id = "foo" or "bar" and
extract them into a new data array called data2.
Alas, at this point I cannot even slice into @data and select the "id"
fields.
print $atm[(0..2)]; # Gives: HASH(0x121064)
print @atm[(0..2)]; # Gives:
HASH(0x121064)HASH(0x11a0e0)HASH(0x112ce8)
print @atm[(0..2)]{"id"}; # Gives: compilation error.
print $atm[(0..2)]{"id"}; # Gives: string id tag for index 2
Thanks.
------------------------------
Date: Wed, 10 Sep 2003 14:17:41 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: altalingua@hotmail.com (David Morel)
Subject: Re: Speeding up LWP::Simple
Message-Id: <a6d24cfde521d3dfa036ca171337bd61@news.teranews.com>
>>>>> "David" == David Morel <altalingua@hotmail.com> writes:
David> I am looking to collect the HTML of approximately 30 million urls, in
David> as simple a manner as possible, perhaps using the LWP::Simple module.
Are you the next google.com, or a spammer? You're using a hotmail
address, so I suspect the latter.
David> If I choose to use LWP::Simple, how can I speed up the process?
If you're a spammer, can you actually expect a lot of help?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 10 Sep 2003 16:34:39 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Speeding up LWP::Simple
Message-Id: <1063204587.248701@halkan.kabelfoon.nl>
Randal L. Schwartz wrote:
>>>>>>"David" == David Morel <altalingua@hotmail.com> writes:
>
>
> David> I am looking to collect the HTML of approximately 30 million urls, in
> David> as simple a manner as possible, perhaps using the LWP::Simple module.
>
> Are you the next google.com, or a spammer? You're using a hotmail
> address, so I suspect the latter.
>
> David> If I choose to use LWP::Simple, how can I speed up the process?
>
> If you're a spammer, can you actually expect a lot of help?
Let give spammers enough rope to hang themselves. I don't mind if
spammers would send mail to each and every email address in the world.
The bigger the problem gets the more likely it is that it is banned and
serious action will be taken.
Just my not so humble opinion :-)
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5477
***************************************