[22013] in Perl-Users-Digest
Perl-Users Digest, Issue: 4235 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 9 09:06:02 2002
Date: Mon, 9 Dec 2002 06:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 9 Dec 2002 Volume: 10 Number: 4235
Today's topics:
Attempt to free unreferenced scalar?!?!?! (Nick Heppleston)
Re: Attempt to free unreferenced scalar?!?!?! <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: Attempt to free unreferenced scalar?!?!?! (Anno Siegel)
Confused by Net::Ping. <spikey-wan@bigfoot.com>
Re: CPAN urls (Anno Siegel)
Re: Currency Regular expression <nmihai_2000@yahoo.com>
Re: Currency Regular expression <blue_elephant55@hotmail.com>
Re: disappearing subject line in sendmail news@roaima.freeserve.co.uk
Re: disappearing subject line in sendmail <flavell@mail.cern.ch>
Re: first element of a hash <feuer.teufel@gmx.net>
Re: first element of a hash <bart.lateur@pandora.be>
Re: Help Im losing faith! VERY JUICY PROBLEM! (Anno Siegel)
Re: Help with "Chomp" Command <flavell@mail.cern.ch>
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
OT: Re: How to substitute ' by \' <rev_1318@hotmail.com>
problem with slash and backslash : strange behaviour wi (Pascal)
Re: problem with slash and backslash : strange behaviou <tassilo.parseval@post.rwth-aachen.de>
Re: read from a process <RobTM@fake.addr.ess>
Re: read from a process <RobTM@fake.addr.ess>
The CPAN Police (was: Re: first element of a hash) <bart.lateur@pandora.be>
Re: Two pppd's one after the other... (Vittorio)
Re: Why doesn't my array grow? <kharrison@icshq.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Dec 2002 03:39:10 -0800
From: nickheppleston@gmx.co.uk (Nick Heppleston)
Subject: Attempt to free unreferenced scalar?!?!?!
Message-Id: <150151d5.0212090339.3e3b8dd0@posting.google.com>
I've written a small script that pushes files via the Net::FTP module
to various servers. The script works fine, however i've just taken two
days off work to come back to the script eating _all_ my system
resources!!!
Looking in the error log, i get the following error:
Attempt to free unreferenced scalar at /usr/lib/perl5/5.6.0/Carp/Heavy
+.pm line 137.
I've investigated upgrading the Carp::Heavy module via CPAN, but i'm
currently running the latest version - is this a known bug? How would
i resolve said problem? Any help would be greatly appreciated. If any
code is required, please let me know.
Many thanks for you help on this matter.
Nick
------------------------------
Date: Mon, 09 Dec 2002 12:53:35 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Attempt to free unreferenced scalar?!?!?!
Message-Id: <newscache$a1pu6h$90h$1@news.emea.compuware.com>
Nick Heppleston wrote (Monday 09 December 2002 12:39):
> Attempt to free unreferenced scalar at /usr/lib/perl5/5.6.0/Carp/Heavy
> +.pm line 137.
"man perldiag" suggests (more or less) that this is a Perl bug. But then
again, if I recall correctly 5.6.0 is not a recommendable version.
--
KP
------------------------------
Date: 9 Dec 2002 12:05:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Attempt to free unreferenced scalar?!?!?!
Message-Id: <at20us$pbr$1@mamenchi.zrz.TU-Berlin.DE>
According to Nick Heppleston <nickheppleston@gmx.co.uk>:
> I've written a small script that pushes files via the Net::FTP module
> to various servers. The script works fine, however i've just taken two
> days off work to come back to the script eating _all_ my system
> resources!!!
Which resources? Memory? Disk space? CPU time? Network Bandwidth?
Swap space? Others? All of them at once seems unlikely.
> Looking in the error log, i get the following error:
>
> Attempt to free unreferenced scalar at /usr/lib/perl5/5.6.0/Carp/Heavy
> +.pm line 137.
This message doesn't necessarily mean that Carp is the reason for
your problems. While Perl normally shouldn't attempt to free
unallocated memory, when resources are scarce things can go wrong in
unexpected ways.
> I've investigated upgrading the Carp::Heavy module via CPAN, but i'm
> currently running the latest version - is this a known bug? How would
> i resolve said problem? Any help would be greatly appreciated. If any
> code is required, please let me know.
You should first find out why your program uses more resources than
it should. Maybe you need to discard some growing lists from time to
time.
Anno
------------------------------
Date: Mon, 9 Dec 2002 13:12:44 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Confused by Net::Ping.
Message-Id: <at24to$2op$1@newshost.mot.com>
Hello World!
I'm trying to write a routine that measures ping times, and stores them in a
spreadsheet. I need pretty accurate times, and I also need to know whether
the host in unreacheable, or whether the ping times out.
I'm using Time::HiRes, and Net::Ping.
This is what I have so far, and why...
First I set up the ping variables, which are setup by the user in a GUI. For
this example, the $ping_timeout is set to 10 seconds.
$ping = Net::Ping -> new ("udp", $ping_timeout, $ping_size);
# $ping_timeout is in seconds, and $ping_size is in bytes.
# Now, if the user enters a name for the host, I need to check if it's
valid, so...
if (!defined ($ping -> ping ($ping_host, $ping_timeout))) {die "Cannot
resolve hostname";}
This bit seems to work, so if you put an unresolveable host name in, it
stops. If you enter an invalid IP address, it drops through, but I don't
think there's a way of trapping that.
# PING TEST LOOP
# The user defines how many pings to do in $ping_number, this would
typically be around 100.
for ($loop = 1; $loop <= $ping_number; $loop++) {
# This does the ping, and times it.
$start = [gettimeofday()];
if ($ping -> ping ($ping_host, $ping_timeout)) {$success = 1;}
else {$success = 0;}
$end = [gettimeofday()];
$interval = (tv_interval ($start, $end) * 1000); # $interval in ms.
# $interval should be how long the ping took, plus a very small amount of
program execution time.
# Now, if the ping command times out, then $success should be 0, and the
$interval should be at least equal to the timeout.
if ($success eq 0) {print "The ping failed\n";}
else {print "The ping was OK\n";}
# IF PING TIMES OUT
if (($interval / 1000) >= $ping_timeout) { # $ping_timeout in seconds
print "Request timed out.\n";}
# IF PING DOESN'T TIME OUT
if (($interval / 1000) < $ping_timeout) {
print "Reply from $ping_host: bytes=$ping_size time=$interval ms\n";}
usleep ($ping_interval * 1000); # NOTE USLEEP RUNS IN MICROSECONDS -
$ping_interval is in ms.
}
So, if I set the $ping_host to nostrils, then the script dies, as the ping
can't get an ip address for them. So far, so good. If I give it the name of
a machine in the office, it pings it, says that the ping was OK , and
returns times in the region of 0-10 ms, as does the DOS ping.
The problem arises when I ping a host on our intranet, that's in another
country, or building. It says that the ping failed, but the timings are in
the region of 100 ms, which again match those from the DOS ping.
In really can't work out what's going on here, can someone see what I did
wrong? Surely if the ping fails, the time $interval should be in the region
of the timeout $ping_timeout??! So how can there be 100ms intervals that
have failed?
By the way, I know that I'm not acting on $success, but that's because I'm
still testing it. When I know it's working properly, I'll add a check for
that.
Thanks.
R.
------------------------------
Date: 9 Dec 2002 11:22:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: CPAN urls
Message-Id: <at1uei$mjl$1@mamenchi.zrz.TU-Berlin.DE>
According to ^darkage <darkage@freeshellzzzz.org>:
> The first URL in my cpan ftp list is one that keeps on maxing out on anon
> users, etc. I know how to add a url by "o conf urlist push
> http://www.cpan.org" but how do you remove the url u dont want cpan to try
> no more?
Read the docs. As "perldoc CPAN" explains, "o conf urllist" not only
understands "push", but also "pop", "unshift" and even "splice". You
should be able to make any change to the urllist with these.
It is sometimes easier to edit the configuration file(s) directly.
Watch the output of "o conf" to see what and where they are.
Anno
------------------------------
Date: Mon, 09 Dec 2002 08:44:22 GMT
From: "Mihai N." <nmihai_2000@yahoo.com>
Subject: Re: Currency Regular expression
Message-Id: <Xns92DF78A4AA13MihaiN@216.148.227.77>
> Hi Group,
>
> I'm trying to write a regular expression which will validate a
> currency string.
Take care!
If there are any chances that the application will be used
for somewhere else than U.S., you may have troubles with
this kind of validation.
Mihai
------------------------------
Date: Mon, 9 Dec 2002 11:00:38 +0100
From: "Thomas Mlynarczyk" <blue_elephant55@hotmail.com>
Subject: Re: Currency Regular expression
Message-Id: <at1plf$40t$06$1@news.t-online.com>
Also sprach Elf:
> (?:\.\d{1,2}){0,1} - an optional group of a full stop followed by 1 or
> 2 digits
I think you can replace the "{0,1}" by a "?": "(?:\.\d{1,2})?"... In which
way does it not work? BTW, the "(?:)" does not work in IE4/5 (not sure about
other browsers).
--
Thomas Mlynarczyk
http://members.surfeu.de/home/tomtomatic
ME VELLE CIVEM ESSE TOTIUS MUNDI NON UNIUS OPPIDI.
------------------------------
Date: Mon, 9 Dec 2002 11:13:16 +0000
From: news@roaima.freeserve.co.uk
Subject: Re: disappearing subject line in sendmail
Message-Id: <cst1ta.opv.ln@moldev.cmagroup.co.uk>
In article <3df10cbb.2685775@news.synapse.net>, Ron <nor@htmlcompendium.org> wrote:
> open (MAIL, "|/usr/sbin/sendmail -t") or dienice("Can't access the mail program!\n");
> print MAIL "To: $email\n";
> print MAIL "From: $myemail\n";
> print MAIL "Reply-to: $myemail\n";
> print MAIL "Subject: <C> account\n";
> print MAIL "other lines for the body of the message\n\n";
> print MAIL "signature block\n\n";
> close (MAIL);
Walter Roberson <roberson@ibd.nrc.ca> wrote:
> You should be putting an empty line between the headers and the body.
> If you fail to do so then the headers will extend until the first empty
> line of the body.
Further, since you're using "-t", you presumably know that the To line
will be parsed by sendmail to determine the recipient(s) - which means
that the $email variable needs to be sanitised. Also, you need to ensure
that $email, $myemail, and any other variable that gets interpolated
into the headers cannot contain a newline.
Consider whether you really need to use "-t", or whether you would be
better off stating the recipients explicitly in the envelope:
open (MAIL, "| /usr/sbin/sendmail $receipient_list" or die...
...
close MAIL or die "Can't send email: $!\n";
Better still, consider using Net::SMTP or one of the other email sending
modules that have already resolved these issues.
Chris
--
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
------------------------------
Date: Mon, 9 Dec 2002 14:15:25 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: disappearing subject line in sendmail
Message-Id: <Pine.LNX.4.40.0212091408560.8521-100000@lxplus076.cern.ch>
On Dec 9, news@roaima.freeserve.co.uk inscribed on the eternal scroll:
> In article <3df10cbb.2685775@news.synapse.net>, Ron <nor@htmlcompendium.org> wrote:
> > open (MAIL, "|/usr/sbin/sendmail -t") or dienice("Can't access the mail program!\n");
[...]
> Consider whether you really need to use "-t",
Yeah, plus whether you oughtn't to be including the -oi option,
otherwise the content body itself is a threat.
> Better still, consider using Net::SMTP or one of the other email sending
> modules that have already resolved these issues.
Indeed.
------------------------------
Date: Mon, 09 Dec 2002 09:17:35 +0100
From: Torsten Werner <feuer.teufel@gmx.net>
Subject: Re: first element of a hash
Message-Id: <mbk8vuo9kthv71n5diamh3f8rjtqldkthv@4ax.com>
Have a look on
http://search.cpan.org/author/BINKLEY/Tie-InsertOrderHash-0.01/InsertOrderHash.pm
Torsten
------------------------------
Date: Mon, 09 Dec 2002 11:26:11 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: first element of a hash
Message-Id: <i5v8vu40c8vn0hs8aob2cctf4m43s53vl0@4ax.com>
stig wrote:
>i have a sorted hash
Can't be. Hashes are unsorted by nature. If you really want a sorted
hash, as in PHP, then look at the module Tie::IxHash, on CPAN
<http://search.cpan.org/search?query=Tie%3A%3AIxHash>
(And that's a capital i, not a lower case L.)
In this case, I'd expect keys() to be in the embedded sort order,
values() their equivalent values, and each() to return pairs in the same
order.
--
Bart.
------------------------------
Date: 9 Dec 2002 10:26:23 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help Im losing faith! VERY JUICY PROBLEM!
Message-Id: <at1r4f$r39$1@mamenchi.zrz.TU-Berlin.DE>
According to Ben Morrow <mauzo@mimosa.csv.warwick.ac.uk>:
> mod3@hotmail.com (LazyPerfectionist) wrote:
> >Here is another one for u...
> >What if I do this
> >
> >$h_data{$lineNo}->{\%{$a_header[$i]}} =
>
> You don't need this ->: it is implied between {} and [] sets.
> \%{...} does precisely nothing: it derefs the reference in ... and then
> immediately takes it's reference. [1]
Well, if $x is an object that overloads '%{}', \%{ $x} and $x can be
different. Not that this is likely to matter in the case at hand,
but I thought I'd mention it.
Anno
------------------------------
Date: Mon, 9 Dec 2002 14:31:34 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Help with "Chomp" Command
Message-Id: <Pine.LNX.4.40.0212091417590.8521-100000@lxplus076.cern.ch>
On Dec 8, Tad McClellan inscribed on the eternal scroll:
> The docs that come with perl will always be in sync with that perl version.
True enough, but they will also contain any documentation bugs that
subsequently got fixed; so although your advice will probably be good
more often than not, it isn't quite such a clear choice as you imply.
------------------------------
Date: Mon, 09 Dec 2002 12:38:52 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <uv93ms7h321h7f@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 02 Dec 2002 13:32:34 GMT and ending at
09 Dec 2002 12:26:45 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2002 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 76 (32.8% of all posters)
Articles: 142 (18.9% of all articles)
Volume generated: 282.4 kb (19.5% of total volume)
- headers: 117.4 kb (2,289 lines)
- bodies: 157.7 kb (5,291 lines)
- original: 113.4 kb (3,972 lines)
- signatures: 7.2 kb (230 lines)
Original Content Rating: 0.719
Averages
========
Posts per poster: 1.9
median: 1.0 post
mode: 1 post - 48 posters
s: 2.1 posts
Message size: 2036.8 bytes
- header: 846.7 bytes (16.1 lines)
- body: 1136.9 bytes (37.3 lines)
- original: 817.6 bytes (28.0 lines)
- signature: 52.2 bytes (1.6 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
9 29.1 ( 7.4/ 21.7/ 12.4) Simon <simonf@simonf.com>
8 16.6 ( 6.5/ 8.9/ 6.8) Logan Shaw <lshaw-usenet@austin.rr.com>
6 7.5 ( 4.7/ 2.1/ 0.8) Robert Szczygiel <RobTM@fake.addr.ess>
5 11.4 ( 4.8/ 6.6/ 2.3) "Chris Boston" <cboston@e-duct-tape.com>
5 7.0 ( 4.6/ 2.4/ 1.8) "Julian Mehnle" <julian@mehnle.net>
5 20.7 ( 4.2/ 11.8/ 5.7) Alexander Stremitzer <stremitz@consultant.com>
4 10.0 ( 3.0/ 6.9/ 3.5) LazyPerfectionist <mod3@hotmail.com>
4 8.4 ( 3.4/ 5.0/ 2.8) Ben Morrow <mauzo@ux-ma160-16.csv.warwick.ac.uk>
4 8.3 ( 3.5/ 4.9/ 3.9) "a2liter" <crb@wedesigns.com>
3 4.9 ( 2.1/ 2.8/ 1.6) Mitchell Laks <mlaks2000@yahoo.com>
These posters accounted for 7.1% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
29.1 ( 7.4/ 21.7/ 12.4) 9 Simon <simonf@simonf.com>
20.7 ( 4.2/ 11.8/ 5.7) 5 Alexander Stremitzer <stremitz@consultant.com>
16.6 ( 6.5/ 8.9/ 6.8) 8 Logan Shaw <lshaw-usenet@austin.rr.com>
12.4 ( 3.5/ 9.0/ 8.2) 3 "Brad W. Galiette" <brad.galiette@snet.net>
11.4 ( 4.8/ 6.6/ 2.3) 5 "Chris Boston" <cboston@e-duct-tape.com>
10.0 ( 3.0/ 6.9/ 3.5) 4 LazyPerfectionist <mod3@hotmail.com>
8.4 ( 3.4/ 5.0/ 2.8) 4 Ben Morrow <mauzo@ux-ma160-16.csv.warwick.ac.uk>
8.3 ( 3.5/ 4.9/ 3.9) 4 "a2liter" <crb@wedesigns.com>
7.5 ( 4.7/ 2.1/ 0.8) 6 Robert Szczygiel <RobTM@fake.addr.ess>
7.0 ( 1.4/ 5.5/ 5.5) 2 Koos Pol <NO.koos.JUNK.pol.MAIL@raketnet.nl>
These posters accounted for 9.1% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 1.7 / 1.7) 3 "paul-new" <paul@nohotmail..com>
0.950 ( 2.1 / 2.2) 3 Lou Moran <lou.moran@gellerandwind.com>
0.916 ( 8.2 / 9.0) 3 "Brad W. Galiette" <brad.galiette@snet.net>
0.797 ( 3.9 / 4.9) 4 "a2liter" <crb@wedesigns.com>
0.772 ( 6.8 / 8.9) 8 Logan Shaw <lshaw-usenet@austin.rr.com>
0.734 ( 1.8 / 2.4) 5 "Julian Mehnle" <julian@mehnle.net>
0.683 ( 0.6 / 0.8) 3 "Sameer" <iamsameer@hotmail.com>
0.666 ( 2.7 / 4.1) 3 astone <astone@i.net>
0.573 ( 12.4 / 21.7) 9 Simon <simonf@simonf.com>
0.557 ( 2.8 / 5.0) 4 Ben Morrow <mauzo@ux-ma160-16.csv.warwick.ac.uk>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.734 ( 1.8 / 2.4) 5 "Julian Mehnle" <julian@mehnle.net>
0.683 ( 0.6 / 0.8) 3 "Sameer" <iamsameer@hotmail.com>
0.666 ( 2.7 / 4.1) 3 astone <astone@i.net>
0.573 ( 12.4 / 21.7) 9 Simon <simonf@simonf.com>
0.557 ( 2.8 / 5.0) 4 Ben Morrow <mauzo@ux-ma160-16.csv.warwick.ac.uk>
0.556 ( 1.6 / 2.8) 3 Mitchell Laks <mlaks2000@yahoo.com>
0.500 ( 3.5 / 6.9) 4 LazyPerfectionist <mod3@hotmail.com>
0.482 ( 5.7 / 11.8) 5 Alexander Stremitzer <stremitz@consultant.com>
0.380 ( 0.8 / 2.1) 6 Robert Szczygiel <RobTM@fake.addr.ess>
0.347 ( 2.3 / 6.6) 5 "Chris Boston" <cboston@e-duct-tape.com>
15 posters (19%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
6 comp.lang.perl.modules
5 alt.perl
3 microsoft.public.scripting.jscript
3 comp.lang.javascript
1 linux.redhat.misc
1 microsoft.public.vc.ide_general
1 comp.lang.c
Top 10 Crossposters
===================
Articles Address
-------- -------
2 Paul R. <paul_newsgroups@yahoo.ca>
2 "Thomas Mlynarczyk" <blue_elephant55@hotmail.com>
2 Elf <smltestau@yahoo.com.au>
2 Koos Pol <NO.koos.JUNK.pol.MAIL@raketnet.nl>
1 "paul-new" <paul@nohotmail..com>
1 "regus" <Bart.Geurs@pandora.be>
1 Dan Harkless <usenet@harkless.org>
1 teacraft@163.com.blah
------------------------------
Date: Mon, 09 Dec 2002 13:26:45 +0100
From: Paul van Eldijk <rev_1318@hotmail.com>
Subject: OT: Re: How to substitute ' by \'
Message-Id: <at2267$asa$1@odysseus.uci.kun.nl>
Tad McClellan wrote:
> Julian Mehnle <julian@mehnle.net> wrote:
>> Francesco Moi <francescomoi@europe.com> wrote:
>>> I'm trying to substitute the character ' by \' into a string:
>
>> $text =~ s/\'/\\\'/g;
> ^ ^
> ^ ^
>
>> $text =~ s/([\'\"])/\\$1/g;
> ^ ^
> ^ ^
>
> Backslashes make your code hard to read and understand, so you should
> only backslash when you _must_ backslash.
>
> None of the underlined backslashes above are needed.
Of course you're right, but...
For a less experienced Perl-user it is often difficult to know which
characters need to be escaped and which don't. Also, it is feasable that a
non-meta character like , say, ', will in the future be a special
character. I think that a generalisation of using backslash-escaping for
non-alphanumeric characters makes a Perl program easier to interpret for
an unexperienced user. The rule is then simple:
- All alphanumeric characters are litterals, all escaped ones are special;
- All other characters are special, unless escaped
(Yes, the latter is not true but easy to remember).
Greatings,
Paul
--
$_=q{ ^4;c;14;1b:a^5;16:c^17:e^a;11;19:h^9;15:j^0:k^18:l^13
:n^6:o^7:p^10:r^b;12;1a:s^2:t^3;8:u^1};s{(?<=[;^])(\d)?([\d
abc])}{$a=$1;$2=~/([abc])/?$a*13+ord($1)%87:$1*13+$2}egx;
for(split/:/){($a,@_)=split/[;^]/;@@[@_]=($a)x@_}print@@
------------------------------
Date: 9 Dec 2002 01:24:31 -0800
From: pmonschein@nptest.com (Pascal)
Subject: problem with slash and backslash : strange behaviour with different PC
Message-Id: <c8112499.0212090124.3d06ae94@posting.google.com>
hello,
I have different behaviour between 2 PC with this code :
if ($vpf !~ /^$winpath/)
with :
winpath = C:\ccs\psapp\Build\Dest\.LOCK
vpf = C:/ccs/psapp/Build/Dest
The problem seems to come from the value of $winpath because "\p" from
"\psapp" is interpreted by perl as a regex option.
When I write my code as follow :
if ($vpf !~ /^\Q$winpath/)
it works fine.
But why this code works on a PC and not on another ?
======================================================
On a PC : I need the \Q option
On another : the first code works directly
??? Why ???
The PC have the same configuration and the perl comes from
the package of "MKS Toolkit for developer 8.0" (it is perl 5.6.0 :
perl -v)
Thank you very much
Pascal
------------------------------
Date: 9 Dec 2002 10:02:52 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: problem with slash and backslash : strange behaviour with different PC
Message-Id: <at1poc$fiq$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Pascal:
> I have different behaviour between 2 PC with this code :
> if ($vpf !~ /^$winpath/)
> with :
> winpath = C:\ccs\psapp\Build\Dest\.LOCK
> vpf = C:/ccs/psapp/Build/Dest
>
> The problem seems to come from the value of $winpath because "\p" from
> "\psapp" is interpreted by perl as a regex option.
>
> When I write my code as follow :
> if ($vpf !~ /^\Q$winpath/)
> it works fine.
That's the expected behaviour.
> But why this code works on a PC and not on another ?
>======================================================
> On a PC : I need the \Q option
> On another : the first code works directly
>
> ??? Why ???
>
> The PC have the same configuration and the perl comes from
> the package of "MKS Toolkit for developer 8.0" (it is perl 5.6.0 :
> perl -v)
And it's in both cases 5.6.0? I just browsed perldelta according to
which the \p assertion has been introduced in Perl 5.6.1. That means, a
plain '\p' will fail under 5.6.1 while it works under more previous
releases.
Whatever it is, you should conclude from this behaviour that putting a
string with possibly arbitrary content should not be used as input for a
regular expression, simply because of all those meta-characters that
could be in it. That's where \Q is useful as you have already found out.
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: 9 Dec 2002 13:15:41 GMT
From: Robert Szczygiel <RobTM@fake.addr.ess>
Subject: Re: read from a process
Message-Id: <slrn.pl.av95rt.1mc.RobTM@pcmic25.cern.ch>
Benjamin Goldberg wrote:
>> > The *only* proper solution for avoiding deadlock (if one has no
>> > knowledge of when the child process will produce stuff on it's
>> > stdout or when it will produce stuff on it's stderr), is to redirect
>> > one handle or the other to a file (possibly a temp file), or else
>> > use IO::Select to read from both simultaneously.
>>
>> You are right.
>> What do you think about forking - one process reading stdout, another
>> stderr?
>
> That works, too, of course, but how do you put the data from the two
> streams back together?
If you can not (or do not want to) use temporary files (as it was in the
original question) - this gets a bit complicated (I think you would have
to step into sockets' bussines). Otherwise - stderr and stdout could
simply be placed in the two separate temporary files (missing all the
synchronisation, of course).
So finally, asuming no temporary files, your solution of reading both
streams simultaneously seems the best for me.
RobTM:)
--
** - Why a bike cannot stand up by itself?
** - Because it is two-tyred!
-- http://3226865153/~szczygie --
------------------------------
Date: 9 Dec 2002 13:27:11 GMT
From: Robert Szczygiel <RobTM@fake.addr.ess>
Subject: Re: read from a process
Message-Id: <slrn.pl.av96hf.1mc.RobTM@pcmic25.cern.ch>
Benjamin Goldberg wrote:
[...]
BTW.
perldoc -m IPC::Open3
If WTRFH begins with ">&", then WTRFH will be closed in the parent, and
the child will read from it directly. If RDRFH or ERRFH begins with
"<&", then the child will send output directly to that file handle.
In both cases, there will be a dup(2) instead of a pipe(2) made.
If you try to read from the child's stdout writer and their stderr
writer, you'll have problems with blocking, which means you'll
want to use select(), which means you'll have to use sysread() instead
of normal stuff.
RobTM:)
--
** - Why a bike cannot stand up by itself?
** - Because it is two-tyred!
-- http://3226865153/~szczygie --
------------------------------
Date: Mon, 09 Dec 2002 11:42:40 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: The CPAN Police (was: Re: first element of a hash)
Message-Id: <t109vuggdedhcgfkq2ihcpmiupqg96ee6g@4ax.com>
Torsten Werner wrote:
>Have a look on
>http://search.cpan.org/author/BINKLEY/Tie-InsertOrderHash-0.01/InsertOrderHash.pm
>Torsten
Oh no. Where's the CPAN Police when you need them? This looks like just
another reinvention of an already steadily established wheel, namely
Tie::IxHash, which has its roots back in 1997. This here is the very
first version, 1/2 year old.
Another already notorious example is the existence of some template
modules.
I wish somebody would monitor what's appearing on CPAN, and if
necessary, put a stop to it -- or at least, put a "parental advisory"
sticker onto it :-). There's no use in having 5 or 10 modules on CPAN
all for the same purpose, with no clear advantage of the newer ones over
the already existing ones, but with more bugs. It makes CPAN, and Perl,
look like a mess.
--
Bart.
------------------------------
Date: 9 Dec 2002 05:03:59 -0800
From: vic50@email.it (Vittorio)
Subject: Re: Two pppd's one after the other...
Message-Id: <c942feb2.0212090503.1d7916fc@posting.google.com>
Bart Lateur <bart.lateur@pandora.be> wrote in message news:<b7h7uu03k0b5g7opqom42bknttv32apok3@4ax.com>...
> system()? That will wait until the launched program exits.
Well I did it the following:
-----------------------------------------------------------
#!/usr/bin perl -w
#
print "Begin firstcall\n";
system ("/usr/sbin/pppd call callbacku");
print"End callback\n";
print "Begin answering\n";
system ("/usr/sbin/pppd call secondcall");
#system "ls ppp*";
print "End answer\n";
exit;
--------------------------------------------------
Without success. As a matter of fact - keeping an eye on
/var/log/messages - I see starting and completing the first call pppd
process only (not the second), whilst the perl program is executed to
the end (It prints "End answer").
PLEASE HELP
Vittorio
------------------------------
Date: Mon, 9 Dec 2002 08:24:52 -0500
From: Keith Harrison <kharrison@icshq.com>
Subject: Re: Why doesn't my array grow?
Message-Id: <MPG.185e63adc0995fa1989685@msunews.cl.msu.edu>
Good example of why you should use 'use strict'
> Rob Richardson wrote:
>
> > if ($currentIndex < 1 || $currentIndex > $daysInThisMonth)
> > {
> > $calendar[currentIndex] = ""
>
> You're missing a $ on the currentIndex variable.
>
>
------------------------------
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 4235
***************************************