[21749] in Perl-Users-Digest
Perl-Users Digest, Issue: 3953 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 11 06:05:49 2002
Date: Fri, 11 Oct 2002 03:05:09 -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 Fri, 11 Oct 2002 Volume: 10 Number: 3953
Today's topics:
5.8.0 opening command bug ? <alexandre.bustico@cena.fr>
Re: 96-column punched-card data <bik.mido@tiscalinet.it>
Re: 96-column punched-card data <krahnj@acm.org>
Any way around using the $& variable? (Peter J. Acklam)
Re: Bug or weird thing? <pinyaj@rpi.edu>
Re: Bug or weird thing? <s_grazzini@hotmail.com>
Re: How to test for blessedness? <goldbb2@earthlink.net>
Re: Multiple Pings/Second <goldbb2@earthlink.net>
Re: Multiple Pings/Second <goldbb2@earthlink.net>
Re: Multiple Pings/Second (Damian James)
Re: Multiple Pings/Second <flavell@mail.cern.ch>
Re: Net::FTP: Unexpected EOF on command channel (John J. Chew III)
Re: Net::FTP: Unexpected EOF on command channel (Villy Kruse)
Re: Newbie question regarding system command <goldbb2@earthlink.net>
Perl code generated by glade (Berry Vos)
Re: POP3 Client <capraro@inotech.de>
Re: PPM installer: "Could not locate a PPD file for pa <rereidy@indra.com>
Re: PPM installer: "Could not locate a PPD file for pa (Helgi Briem)
Re: PPM installer: "Could not locate a PPD file for pa (Helgi Briem)
Re: Problem with require() versus in-line code <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Re: Should -i eat my files? <johannes.fuernkranz@t-online.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Oct 2002 10:58:46 +0200
From: Alexandre BUSTICO <alexandre.bustico@cena.fr>
Subject: 5.8.0 opening command bug ?
Message-Id: <qdvg49qrll.fsf@cena.fr>
i have upgraded my linux box in mandrake 9.0, perl 5.8 commes bundled with, and
now a simple script don't works anymore :
# i vait for dnotify output
# http://freshmeat.net/projects/dnotify/?topic_id=862
open (FH, '-|', '/usr/local/bin/dnotify -mrcdR /tmp/ES') || die ("dnotify err");
while (<FH>) {
chomp ();
print "DGB> $_\n";
}
normaly when there is activity in the directory the script should write the
directory where it happens.
It's work with 5.6, but hangs in 5.8, i have tried several options of perlio
with no success.
If i modify the script so that it reads stdin, and launch it like that :
/usr/local/bin/dnotify -mrcdR /tmp/ES | script.pl
then it works ...
any clue ?
Thanks
--
Alexandre Bustico
Email: Alexandre.Bustico@cena.fr
CENA 7 avenue Edouard Belin BP 4005 | Phone: (+33) 05 62 25 95 41
31055 Toulouse Cedex, FRANCE | Fax: (+33) 05 62 25 95 99
------------------------------
Date: Fri, 11 Oct 2002 08:06:37 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: 96-column punched-card data
Message-Id: <ktkbqugg899ejb5ap4li9cf4hi6ko2s9qa@4ax.com>
On Tue, 08 Oct 2002 18:35:18 -0400, Benjamin Goldberg
<goldbb2@earthlink.net> wrote:
>This line:
> print +(split //)[TRANSLATE];
>Could be written more verbosely as:
> @temp = split //, $_;
> @reordered = @temp[TRANSLATE];
> print @reordered;
Why are the two forms equivalent? More precisely why does one need the
'+'? (and omitting it generates an error).
Note: of course I'm aware of the fact that I could put the argument to
print in parentheses...
Michele
--
Liberta' va cercando, ch'e' si' cara,
Come sa chi per lei vita rifiuta.
[Dante Alighieri, Purg. I, 71-72]
I am my own country - United States Confederate of Me!
[Pennywise, "My own country"]
------------------------------
Date: Fri, 11 Oct 2002 07:01:07 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: 96-column punched-card data
Message-Id: <3DA67716.64FCAD6B@acm.org>
Michele Dondi wrote:
>
> On Tue, 08 Oct 2002 18:35:18 -0400, Benjamin Goldberg
> <goldbb2@earthlink.net> wrote:
>
> >This line:
> > print +(split //)[TRANSLATE];
> >Could be written more verbosely as:
> > @temp = split //, $_;
> > @reordered = @temp[TRANSLATE];
> > print @reordered;
>
> Why are the two forms equivalent? More precisely why does one need the
> '+'? (and omitting it generates an error).
perldoc -f print
[snip]
Also be careful not to follow the print keyword
with a left parenthesis unless you want the
corresponding right parenthesis to terminate the
arguments to the print--interpose a `+' or put
parentheses around all the arguments.
John
--
use Perl;
program
fulfillment
------------------------------
Date: 11 Oct 2002 00:44:53 -0700
From: pjacklam@online.no (Peter J. Acklam)
Subject: Any way around using the $& variable?
Message-Id: <fe4612a5.0210102344.17bccee4@posting.google.com>
I want to highlight the text matched by an arbitrary regex,
but I can't find any way around using the $& variable in
the substitution. Is there any way to avoid using it?
Here is an stripped-down example script
#!/usr/bin/perl -wp
BEGIN { $regex = shift }
s/$regex/\e[36m$&\e[m/go; # note the "$&"
In the following example, "bar" is colored:
$ echo "foobarbaz" | ./tmp.pl bar
foobarbaz
In the following example, "oo" and "arba" is colored:
$ echo "foobarbaz" | ./tmp.pl '([oa]).*\1'
foobarbaz
Is there really no way around using $& in the substitution?
Peter
------------------------------
Date: Fri, 11 Oct 2002 01:56:24 -0400
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
To: Domizio Demichelis <dd@4pro.net>
Subject: Re: Bug or weird thing?
Message-Id: <Pine.A41.3.96.1021011015339.62320A-100000@cortez.sss.rpi.edu>
[posted & mailed]
On Thu, 10 Oct 2002, Domizio Demichelis wrote:
>Why the SCALAR slot of a symboltable is ALWAYS defined, while the ARRAY,
>HASH and CODE slots are not?
It's not a bug. It's just The Way It Is. From 'perlmod':
*foo{THING} returns undef if that particular THING hasn't been used
yet, except in the case of scalars. *foo{SCALAR} returns a refer-
ence to an anonymous scalar if $foo hasn't been used yet. This
might change in a future release.
--
Jeff "japhy" Pinyan RPI Acacia Brother #734 2002 Acacia Senior Dean
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
Date: 10 Oct 2002 20:49:48 -0600
From: Steve Grazzini <s_grazzini@hotmail.com>
Subject: Re: Bug or weird thing?
Message-Id: <3da63c4b@news.mhogaming.com>
Domizio Demichelis <dd@4pro.net> wrote:
> Why the SCALAR slot of a symboltable is ALWAYS defined,
> while the ARRAY, HASH and CODE slots are not?
$ perldoc perlref
...
7. A reference can be created by using a special syntax,
lovingly known as the *foo{THING} syntax. *foo{THING}
returns a reference to the THING slot in *foo (which
is the symbol table entry which holds everything known
as foo).
$scalarref = *foo{SCALAR};
...
*foo{THING} returns undef if that particular THING
hasn't been used yet, except in the case of scalars.
*foo{SCALAR} returns a reference to an anonymous
scalar if $foo hasn't been used yet. This might
change in a future release.
So I guess it's a "weird thing", not a bug. :)
--
Steve
perldoc -qa.j | perl -lpe '($_)=m("(.*)")'
------------------------------
Date: Fri, 11 Oct 2002 00:54:44 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How to test for blessedness?
Message-Id: <3DA65994.AA531F@earthlink.net>
Da Witch wrote:
>
> I'm sure this is much simpler than I'm making it, but I can't see
> it... Is there a better (i.e. more direct) way to test for
> blessedness than something like
>
> sub is_blessed { eval { (shift)->isa(0) }; !$@ }
All blessed objects are subclasses of UNIVERSAL, so:
sub is_blessed { UNIVERSAL::isa $_[0], "UNIVERSAL" }
PS: Classes are allowed to overload their ->isa method. This can be a
good thing, sometimes, but it's possible for an overloaded isa to have
side-effects (action at a distance), which would be bad. UNIVERSAL::isa
has no side-effects.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Fri, 11 Oct 2002 00:31:21 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Multiple Pings/Second
Message-Id: <3DA65419.A4557A7B@earthlink.net>
Alan J. Flavell wrote:
>
> On Oct 10, Rocco Caputo inscribed on the eternal scroll:
>
> [along with much that I'd have no argument with...]
>
> > Reliability aside, it doesn't seem very responsible to squirt
> > packets onto a network faster than the network (the local interface
> > included) can handle them. The result is a program that generates
> > more traffic and takes longer than necessary.
> >
> > To be fair, ICMP packets tend to be smaller than UDP ones,
>
> If you're using them to ping a host, they can be as large - up to some
> max - or as small, down to some minimum - as you choose them to be -
> whether ICMP or UDP.
If you're only testing for whether a host is alive or not, there's no
reason to send more than the minimal ping packet... as far as I can
think of, any way.
> If you're looking at the population of packets on a network, then
> sure, many of the UDP packets will have a large payload of data, and
> many of the ICMP packets will be simple management functions with
> little payload. But that's irrelevant in a discussion of which sort
> to choose for the purpose that's currently under discussion, surely?
>
> The choice would be made by some quite other considerations, IMHO.
Like the fact that many machines don't run UDP echo servers?
Although there are indeed some machines which don't respond to ICMP echo
requests, that's fewer than those which don't have anything listening to
the UDP echo port.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Fri, 11 Oct 2002 00:37:14 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Multiple Pings/Second
Message-Id: <3DA6557A.38DF3A41@earthlink.net>
Rocco Caputo wrote:
>
> On Thu, 10 Oct 2002 16:51:02 -0400, Benjamin Goldberg wrote:
> > Rocco Caputo wrote:
> >> I didn't know for sure what he was doing, so I presented this as
> >> just one option among others. After all I've seen on IRC, I can't
> >> casually dismiss the possibility someone might ping 1500 discrete
> >> addresses just to discover hosts on a few corporate subnets.
> >
> > Uhh, is it even possible to *ping* a broadcast address? And if you
> > *could,* the response packet's "sender" surely would be from the
> > machine which sent the response, not the broadcast address.
>
> Yes, if it's enabled in your kernel and your routers don't drop them.
> And yes, the response will come back with the host address rather than
> the broadcast address.
>
> > The logic for testing if ping packet is really one we care about
> > would need significant improvement if it's possible to ping one
> > address and get the corresponding response from a different address.
>
> It's more interesting than that. A single multicast echo request can
> return one reply for each machine that answers. So if you're pinging
> broadcast addresses, it's important to wait the full timeout period
> even if you get a response.
>
> POE::Component::Client::Ping supports this by matching replies with
> requests according to their sequence number.
>
> Another interesting bit: Since pingers all listen on socket 0, they
> can hear each other's responses. To avoid collisions, the identifier
> field (the 16 bits before the sequence number) usually holds a hash of
> the pinger's process ID. Anything that doesn't match is discarded.
Hmm, I was using the sequence number as a sortof assistant identifyer
field.
On windows 95, if you run two perl scripts, one after another, and no
other processes start/die in between, it's quite likely that the pid
will be reused from one process to the next. If you type:
perl -e "print $$"
twice in a row, it will print the same number, twice in a row.
How harmful is that?
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: 11 Oct 2002 06:09:09 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Multiple Pings/Second
Message-Id: <slrnaqcqo5.cie.damian@puma.qimr.edu.au>
On Fri, 11 Oct 2002 00:37:14 -0400, Benjamin Goldberg said:
>...
>On windows 95, if you run two perl scripts, one after another, and no
>other processes start/die in between, it's quite likely that the pid
>will be reused from one process to the next. If you type:
> perl -e "print $$"
>twice in a row, it will print the same number, twice in a row.
For no particular reason, I tried this verbatim in bash on cygwin on
win2k. Of course, the double quotes mean $$ was interpolated in the
shell before perl saw it. So obviously it was always the same.
>How harmful is that?
Well...
$ uname
SunOS
$ perl -e 'system(q/perl/, q/-le/, q/print $$/) for 0..9'
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
$ uname
OpenBSD
$ perl -e 'system(q/perl/, q/-le/, q/print $$/) for 0..9'
14398
17403
193
19579
8193
8098
12834
9560
7096
16410
... so I guess it depends on what you're paranoid about.
--damian
------------------------------
Date: Fri, 11 Oct 2002 11:17:48 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Multiple Pings/Second
Message-Id: <Pine.LNX.4.40.0210111111570.2114-100000@lxplus071.cern.ch>
On Oct 11, Benjamin Goldberg inscribed on the eternal scroll:
> Alan J. Flavell wrote:
> >
> > On Oct 10, Rocco Caputo inscribed on the eternal scroll:
> > > To be fair, ICMP packets tend to be smaller than UDP ones,
[...]
> > The choice would be made by some quite other considerations, IMHO.
>
> Like the fact that many machines don't run UDP echo servers?
Yes, but now you've digressed completely from the specific point that
I was addressing.
Maybe I'm trying to test whether a particular UDP service is alive,
rather than merely to discover whether an interface is up? On our old
router, the interface would respond quite autonomously to ICMP pings,
irrespective of whether the main routing engine was working normally
or totally belly-up. With respect, I had just wanted to address the
point:
> > > To be fair, ICMP packets tend to be smaller than UDP ones,
which had been made - I didn't want to hijack this thread for a
comprehensive discussion of network monitoring. Is that OK?
all the best
------------------------------
Date: 11 Oct 2002 04:23:12 GMT
From: jjchew@coxeter.math.toronto.edu (John J. Chew III)
Subject: Re: Net::FTP: Unexpected EOF on command channel
Message-Id: <ao5jng$s7d$1@news.math.toronto.edu>
In article <cc028093.0210101130.5fc8d9c1@posting.google.com>,
jend <dejen321@yahoo.com> wrote:
>i have this basic Net::FTP script that goes out to pull a file
>everynight.
>It has been working reliability for the past year until recently we
>switch
>to PASSIVE FTP. So what I did is set env variable FTP_PASSIVE to 1
>and Net::FTP picks up the passive mode from there.
>
>Now the script still works probably 4 or 5 days of the week, but
>fails 2 or 3 times per week saying:
[...]
>Net::FTP: Unexpected EOF on command channel at ./data_pull.pl line 52
>Could not get 'daily_file.gz', skipped: Bad file number at
You probably saw the thread that I started on this topic on 2001-12-30,
which can be found in groups.google.com, e.g. by searching for Net::FTP
and Chew. The gist of it then was that no one knows what's causing it,
but that the problem can be caused or exacerbated by reduced bandwidth
or increased network latency. When I have had the problem, I have tried
turning passive mode on or off without effect, so I think that's a red
herring. Is it possible that the quality of your network connection has
been downgraded recently?
John
--
John Chew (poslfit on MD/WD/PD)
jjchew@math.utoronto.ca * http://www.math.utoronto.ca/jjchew
------------------------------
Date: 11 Oct 2002 07:38:28 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Net::FTP: Unexpected EOF on command channel
Message-Id: <slrnaqcvvj.gnv.vek@station02.ohout.pharmapartners.nl>
On 11 Oct 2002 04:23:12 GMT,
John J. Chew III <jjchew@coxeter.math.toronto.edu> wrote:
>In article <cc028093.0210101130.5fc8d9c1@posting.google.com>,
>jend <dejen321@yahoo.com> wrote:
>>i have this basic Net::FTP script that goes out to pull a file
>>everynight.
>>It has been working reliability for the past year until recently we
>>switch
>>to PASSIVE FTP. So what I did is set env variable FTP_PASSIVE to 1
>>and Net::FTP picks up the passive mode from there.
>>
>>Now the script still works probably 4 or 5 days of the week, but
>>fails 2 or 3 times per week saying:
>[...]
>>Net::FTP: Unexpected EOF on command channel at ./data_pull.pl line 52
>>Could not get 'daily_file.gz', skipped: Bad file number at
>
>You probably saw the thread that I started on this topic on 2001-12-30,
>which can be found in groups.google.com, e.g. by searching for Net::FTP
>and Chew. The gist of it then was that no one knows what's causing it,
>but that the problem can be caused or exacerbated by reduced bandwidth
>or increased network latency. When I have had the problem, I have tried
>turning passive mode on or off without effect, so I think that's a red
>herring. Is it possible that the quality of your network connection has
>been downgraded recently?
>
There can also be a problem with statefull firewalls when you are
transferring big files. The firewall may notice that the command
channel is sitting completely idle for a long time and then determine
that the connection is in fact dead.
Villy
------------------------------
Date: Fri, 11 Oct 2002 00:41:00 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Newbie question regarding system command
Message-Id: <3DA6565C.F4D1ADCD@earthlink.net>
test wrote:
>
> Hi, Is it possible for me to write a perl script that will ping number
> a host and based on the outcome certain parts of the script will be
> executed. For eaxmple:
> $t=system('ping 192.168.1.1');
> If (system is alive or ping works)
> {
> than do something
> }
> else
> {
> print out host is not up
> }
>
> Can i do this in perl?
Either Net::Ping which comes with perl, or Net::Ping::External or
POE::Component::Client::Ping from CPAN.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: 11 Oct 2002 00:31:32 -0700
From: b.vos@getronics.nl (Berry Vos)
Subject: Perl code generated by glade
Message-Id: <d1fa9960.0210102331.168ad907@posting.google.com>
Hi All!
How can I reach the object which fired an callback function?
Let's say I have a window with a button and a text field. When I press
the button, the textfield should be filled with a certain text. How do
I access the textfield in the signal handler function in an object
oriented manner? And how do I get the parent of an object in an signal
handler?
Thanks!
Berry Vos
------------------------------
Date: Fri, 11 Oct 2002 08:14:37 +0200
From: "Primaldo Antonio Capraro jr." <capraro@inotech.de>
Subject: Re: POP3 Client
Message-Id: <ao5q3i$iqa4r$1@ID-152220.news.dfncis.de>
http://search.cpan.org/author/JHI/perl-5.8.0/lib/Net/POP3.pm
versuch es mal damit vieleicht findest du da ne routine die du suchst
Net::POP3 even wurde halt genau fuer sowas gemacht ;o)
c'est la vie
MfG Toni
------------------------------
Date: Thu, 10 Oct 2002 23:33:42 -0600
From: Ron Reidy <rereidy@indra.com>
Subject: Re: PPM installer: "Could not locate a PPD file for package X"
Message-Id: <3DA662B6.F216B3B0@indra.com>
Brian wrote:
>
> I frequently am unsuccseeful using ActiveState's PPM (Perl Package Manager)
> and PPM3 installation programs. The following result is typical, even in the
> case of some common packages. What's the best way of installing these
> modules, and should ActiveState's ppm/ppm3 be avoided?
>
> D:\WINDOWS\system32>ppm install LWP-UserAgent
> Installing package 'LWP-UserAgent'...
> Error installing package 'LWP-UserAgent': Could not locate a PPD file for
> package LWP-UserAgent
This message can indicates there is no archive on AS's site for the
module you are trying to install.
If you go to
http://www.activestate.com/PPMPackages/zips/6xx-builds-only/ and look
for the above module, you will see it does not exist.
You can try to build it using nmake, or you can send an email to AS and
let them know you need the module.
--
Ron Reidy
Oracle DBA
------------------------------
Date: Fri, 11 Oct 2002 09:03:31 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: PPM installer: "Could not locate a PPD file for package X"
Message-Id: <3da69209.194004123@news.cis.dfn.de>
On Thu, 10 Oct 2002 16:52:58 GMT, "Dick Penny"
<penny1482@attbi.com> wrote:
>
>"Helgi Briem" <helgi@decode.is> wrote in message
>> Why haven't you read perldoc ppm which tells
>> you all about this?
>>
>Err, my perldoc has EXACTLY 4 lines on ppm, and they do NOT
>communicate a thing.
Then you have a broken installation or are not using
Activeperl, which is where ppm comes from. My distro has
396 lines on ppm, including these:
ENVIRONMENT VARIABLES
HTTP_proxy
If the environment variable 'HTTP_proxy' is set, then it
will be used as the address of a proxy server for accessing
the Internet.
The value should be of the form: 'http://proxy:port'.
>Again, perldoc sucks.
It is only the best documentation system available
for any programming language/environment in
the world. Maybe you suck.
>Why don't you "folks in the know" give the questioner a bit of help?
We have.
>But speaking of ppm:
>1) why doesn't insalling ppm3 completely wipe out ppm?
They both come together with every Activestate
distro.
>2) since ppm3 is so much of an improvement, why did the gurus
>not change the prompt to ppm3?
If it ain't broke don't fix it. PPM has always worked
perfectly for me, so I have never had any reason to switch
to ppm3.
If you want to know what the differences are, type:
ppm3 help ppm_migration
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 11 Oct 2002 09:08:37 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: PPM installer: "Could not locate a PPD file for package X"
Message-Id: <3da693f2.194493526@news.cis.dfn.de>
On Thu, 10 Oct 2002 23:33:42 -0600, Ron Reidy
<rereidy@indra.com> wrote:
>> D:\WINDOWS\system32>ppm install LWP-UserAgent
>> Installing package 'LWP-UserAgent'...
>> Error installing package 'LWP-UserAgent': Could not locate a PPD file for
>> package LWP-UserAgent
>This message can indicates there is no archive on AS's site for the
>module you are trying to install.
No, that's because the module is in a package called
libwww-perl.
>If you go to
>http://www.activestate.com/PPMPackages/zips/6xx-builds-only/ and look
>for the above module, you will see it does not exist.
No. LWP UserAgent comes standard with Activeperl, so no
need to install it.
However, if you want to upgrade the package, it is part
of the libwww-perl package and can be upgraded with
ppm verify --upgrade libwww-perl
>You can try to build it using nmake, or you can send an email to
>AS and let them know you need the module.
Don't do either of those things.
--
Regards, Helgi Briem
helgi AT decode DOT is
A: Top posting
Q: What is the most irritating thing on Usenet?
- "Gordon" on apihna
------------------------------
Date: Fri, 11 Oct 2002 10:37:53 +0200
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: Problem with require() versus in-line code
Message-Id: <newscache$5n6t3h$hec$1@news.emea.compuware.com>
Jan Klaverstijn wrote (Thursday 10 October 2002 17:38):
> The solution with a package and :: is obscure to me: if I declare "package
> conf;" in file_a.pl that I require in file_b.pl and refer to my data
> structure as
> for my $where ( @{ $conf::fetchmailrc{servers} } ) {
> it still won' work.
>
> I must admit I had hoped it would be easier. More like #include as in C.
Well, actually it is that simple. The problem you are facing is different:
you want to get to variable data while it is outscoped and thus not
visible. But actually that is a Good Thing, because now you are sure that
what you do in your little black box remains save from prying eyes!
> So I hope my package reference above is broken and easily fixed.
> Otherwisre I'll have to revert to another advice, from Koos Pol, to
> implement a sub in the package and call that. This would bridge the
> namespaces but makes the file generation process more complicated.
Why? You can pass to your function variable data, file names, filehandles,
what ever you want. If I run
do_something($on_this_data, $and_export_to_this_file);
...well, it doesn't get easier. Now you moved some
low-level-technical-routine-noone-is-really-interested-in to it's own file.
I don't see this difference in difficulty between writing this routine in
the current file or in a different file and "require"ing it. Better, both
routines are probably textuallly equal. And that concludes to that it
perhaps should have been a routine in the first place!
HTH!
--
KP
------------------------------
Date: Fri, 11 Oct 2002 10:12:13 +0200
From: =?ISO-8859-1?Q?Johannes_F=FCrnkranz?= <johannes.fuernkranz@t-online.de>
Subject: Re: Should -i eat my files?
Message-Id: <ao618d$spm$04$1@news.t-online.com>
John W. Krahn wrote:
>
> perldoc perldiag
> [snip]
> Can't do inplace edit on %s: %s
> (S inplace) The creation of the new file failed for
> the indicated reason.
>
> Can't do inplace edit without backup
> (F) You're on a system such as MS-DOS that gets con
> fused if you try reading from a deleted (but still
> opened) file. You have to say `-i.bak', or some such.
Thanks, I did not know that.
But even if I had known it, I would have assumed that -i simply does not
work on Windows systems. This gives absolutely no indication that it
will delete my files! Shouldn't there at least a big warning somewhere,
or better, an implementation that refuses to use -i on an OS where it can't?
Juffi
------------------------------
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 3953
***************************************