[22244] in Perl-Users-Digest
Perl-Users Digest, Issue: 4465 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 25 09:08:38 2003
Date: Sat, 25 Jan 2003 06:05:07 -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 Sat, 25 Jan 2003 Volume: 10 Number: 4465
Today's topics:
@$x array scalar question (java_dev_train)
Re: @$x array scalar question (h\)
Re: @$x array scalar question (Jay Tilton)
Re: @$x array scalar question (Jay Tilton)
Re: @$x array scalar question (h\)
Re: @$x array scalar question <mpapec@yahoo.com>
Re: Accessing disk and volume information <avishal@vsnl.net>
binmode() please help me <adam878639@hotmail.com>
Re: binmode() please help me <adam878639@hotmail.com>
Re: binmode() please help me <jurgenex@hotmail.com>
Re: binmode() please help me (h\)
Re: binmode() please help me <jurgenex@hotmail.com>
Re: Global (Jay Tilton)
Re: How can a SMTP mail be deleted from a Unix mailbox (Markus Elfring)
Re: How can a SMTP mail be deleted from a Unix mailbox (Markus Elfring)
Perl 5.8.0 <tjudd.01@hotmail.com>
Re: Perl 5.8.0 <tassilo.parseval@post.rwth-aachen.de>
Re: Perl Golf on my Mind <palladium@spinn.net>
PHP execute perl script <tombrooks.nospam@hotmail.com>
Re: PHP execute perl script <tombrooks.nospam@hotmail.com>
Re: Reading French-Accented Data <nmihai_2000@yahoo.com>
Re: Reading French-Accented Data <flavell@mail.cern.ch>
Re: Reverse Inheritance? (Anno Siegel)
Re: unlink() <tassilo.parseval@post.rwth-aachen.de>
Re: Where to find documentation for syntax on "if"? (h\)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 Jan 2003 03:30:51 -0800
From: java_dev_train@yahoo.com (java_dev_train)
Subject: @$x array scalar question
Message-Id: <8bc444d4.0301250330.2881ee4a@posting.google.com>
I understand @a is an array.
I understand $b is a scalar.
I came across this PERL syntax - @$x.
I found the following code on http://perlcircus.com/site/scalars.html
$sca = ["Sue", "Black", "29"];
print @$sca[0];
print $sca->[1];
What is the advantage of the @$sca syntax? I do not understand the usefulness
of this syntax, it seems it would have been intuitive to assign the 3 element
list to an array rather than the scalar variable $sca.
Thank you in advance for the help.
------------------------------
Date: Sat, 25 Jan 2003 13:01:26 +0100
From: "Michael Peuser \(h\)" <post@mpeuser.de>
Subject: Re: @$x array scalar question
Message-Id: <b0tu8q$kuj$02$1@news.t-online.com>
"java_dev_train" <java_dev_train@yahoo.com> schrieb im Newsbeitrag
news:8bc444d4.0301250330.2881ee4a@posting.google.com...
> I understand @a is an array.
> I understand $b is a scalar.
>
> I came across this PERL syntax - @$x.
>
> I found the following code on http://perlcircus.com/site/scalars.html
>
> $sca = ["Sue", "Black", "29"];
> print @$sca[0];
> print $sca->[1];
>
> What is the advantage of the @$sca syntax? I do not understand the
usefulness
> of this syntax, it seems it would have been intuitive to assign the 3
element
> list to an array rather than the scalar variable $sca.
$ca is a reference (pointer) to an array
[..] is a shortcut denotation for \ (....)
Read perlref or a good Perl book.
Kindly Mike
------------------------------
Date: Sat, 25 Jan 2003 12:02:19 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: @$x array scalar question
Message-Id: <3e327690.69570487@news.erols.com>
java_dev_train@yahoo.com (java_dev_train) wrote:
: I understand @a is an array.
: I understand $b is a scalar.
:
: I came across this PERL syntax - @$x.
:
: I found the following code on http://perlcircus.com/site/scalars.html
:
: $sca = ["Sue", "Black", "29"];
: print @$sca[0];
Actually, that would be more properly written as $$sca[0], but the
question it raised for you is still valid.
: print $sca->[1];
:
: What is the advantage of the @$sca syntax? I do not understand the usefulness
: of this syntax, it seems it would have been intuitive to assign the 3 element
: list to an array rather than the scalar variable $sca.
It is assigned to an array--an anonymous array.
$sca is a reference to that array.
There is no advantage to using a reference in that code, but it's just
a sample. Among other things, references are useful for creating
complex data structures, and for passing data to and from subroutines.
Understanding references is fairly crucial to understanding Perl. A
Usenet article simply cannot adequately cover the subject, but there
is much fine documentation on references and how to use them in the
bundled Perl documentation.
perlref
perlreftut
perldsc
perllol
------------------------------
Date: Sat, 25 Jan 2003 12:12:15 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: @$x array scalar question
Message-Id: <3e327d3c.71279110@news.erols.com>
"Michael Peuser \(h\)" <post@mpeuser.de> wrote:
: [..] is a shortcut denotation for \ (....)
No.
$sca = ["Sue", "Black", "29"];
is certainly not the same as
$sca = \( "Sue", "Black", "29" );
Making a reference to a list like that is creating a list of
references to the items in the list, i.e.
$sca = ( \"Sue", \"Black", \"29" );
The list assignment in scalar context puts \"29" into $sca.
------------------------------
Date: Sat, 25 Jan 2003 13:48:48 +0100
From: "Michael Peuser \(h\)" <post@mpeuser.de>
Subject: Re: @$x array scalar question
Message-Id: <b0u11l$nhv$00$1@news.t-online.com>
"Jay Tilton" <tiltonj@erols.com> schrieb im Newsbeitrag
news:3e327d3c.71279110@news.erols.com...
> "Michael Peuser \(h\)" <post@mpeuser.de> wrote:
>
> : [..] is a shortcut denotation for \ (....)
>
> No.
>
> $sca = ["Sue", "Black", "29"];
> is certainly not the same as
> $sca = \( "Sue", "Black", "29" );
> Making a reference to a list like that is creating a list of
> references to the items in the list, i.e.
> $sca = ( \"Sue", \"Black", \"29" );
> The list assignment in scalar context puts \"29" into $sca.
Thank you! Maybe I also should read a good book about Perl...
I think I understand a bug now I met 2 years ago ;-)
Let's say then:
$sca = ["Sue", "Black", "29"];
has a similar result as
@sca = ("Sue", "Black", "29");
$sca =\@sca;
Kindly Mike
------------------------------
Date: Sat, 25 Jan 2003 14:46:13 +0100
From: Matija Papec <mpapec@yahoo.com>
Subject: Re: @$x array scalar question
Message-Id: <28453vgn1jgv3ls686vsis1jecluqd23hk@4ax.com>
X-Ftn-To: java_dev_train
java_dev_train@yahoo.com (java_dev_train) wrote:
>I understand @a is an array.
>I understand $b is a scalar.
>
>I came across this PERL syntax - @$x.
>
>I found the following code on http://perlcircus.com/site/scalars.html
>
>$sca = ["Sue", "Black", "29"];
In this example $sca is reference to anonymous array(reference in general is
scalar which points to something, see perldoc -f ref).
Using references is very useful and effective when you need to pass
arrays/hashes to subs or when dealing with objects.
#make array
my @arr = 5..15;
#make $aref reference to @arr
my $aref = \@arr;
#multiply first element by 2
$arr[0] *= 2;
#same things but via reference
$aref->[0] *= 2; #preferable
$$aref[0] *= 2; #another way
${$aref}[0] *= 2; #another way
#print array
print @arr;
#print array via ref.
print @$aref;
print @{$aref};
--
Matija
------------------------------
Date: Sat, 25 Jan 2003 13:55:46 +0530
From: Vishal Agarwal <avishal@vsnl.net>
Subject: Re: Accessing disk and volume information
Message-Id: <b0th45$m6t$1@news.vsnl.net.in>
Yash wrote:
> Hi,
> Can someone point me the package that I should use to query the system to
> access the information about physical disks and volume groups. I am using
> perl 5.6.1 on HP-UX 11.
>
> Thanks
> Yash
Check out HPUX::Ioscan, HPUX::FS and HPUX::LVM on cpan.org:
http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?request=cat;catinfo=411
vishal
------------------------------
Date: Sat, 25 Jan 2003 01:09:18 -0600
From: "Adam Trotter" <adam878639@hotmail.com>
Subject: binmode() please help me
Message-Id: <1FqY9.6177$zt5.1570@news.bellsouth.net>
Sorry if this double posts, my isp's news server is being a pain
I'm trying to modify a perl script for my college's net admin.... most of it
works right, except for when it comes to the upload functions on windows
boxes. I'm trying to fix that, and I know the answer lies somewhere in
binmode(), and I've tried putting it everywhere that seems logical and I can
not get it to work right :(
Can anyone please take a look at this and give me a hand? The problem I
know is CRLF, because I hex compared a working pic to a corrupted one
uploaded through the script and it inserted junk CRLF bytes into it. The
script is Elite Webpage Builder, avalible at
http://www.elitehosts.com/scripts/builder.zip . Thank you in advance....
Adam
------------------------------
Date: Sat, 25 Jan 2003 01:20:16 -0600
From: "Adam Trotter" <adam878639@hotmail.com>
Subject: Re: binmode() please help me
Message-Id: <jPqY9.6200$zt5.4226@news.bellsouth.net>
I understand that you have to use binmode on windows systems when you read
from and write to binary data, I've spent a LOT of time the past few days
reading pages and pages of stuff about binmode, I just haven't gotten any
luck in getting what I've read to work in the script.
It works fine in my linux server, but on both my XP Pro PC or the school's
Win2K webserver, file uploads get corrupted because of binmode not being set
right somewhere, and that's what I can't figure out. There's a few more
things that need editing with it, which I can do, it's the file upload
problem that has me stuck.
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:MPqY9.480$3E6.246@nwrddc01.gnilink.net...
> Adam Trotter wrote:
> > I'm trying to modify a perl script for my college's net admin....
> > most of it works right, except for when it comes to the upload
> > functions on windows boxes. I'm trying to fix that, and I know the
> > answer lies somewhere in binmode(), and I've tried putting it
> > everywhere that seems logical and I can not get it to work right :(
>
> What exactly is unclear with the second paragraph of the binmode man page
> and needs improvement?
>
> jue
>
>
------------------------------
Date: Sat, 25 Jan 2003 07:14:52 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: binmode() please help me
Message-Id: <MPqY9.480$3E6.246@nwrddc01.gnilink.net>
Adam Trotter wrote:
> I'm trying to modify a perl script for my college's net admin....
> most of it works right, except for when it comes to the upload
> functions on windows boxes. I'm trying to fix that, and I know the
> answer lies somewhere in binmode(), and I've tried putting it
> everywhere that seems logical and I can not get it to work right :(
What exactly is unclear with the second paragraph of the binmode man page
and needs improvement?
jue
------------------------------
Date: Sat, 25 Jan 2003 14:38:16 +0100
From: "Michael Peuser \(h\)" <post@mpeuser.de>
Subject: Re: binmode() please help me
Message-Id: <b0u3u9$lp4$07$1@news.t-online.com>
"Adam Trotter" <adam878639@hotmail.com> schrieb im Newsbeitrag
news:1FqY9.6177$zt5.1570@news.bellsouth.net...
> Sorry if this double posts, my isp's news server is being a pain
>
> I'm trying to modify a perl script for my college's net admin.... most of
it
> works right, except for when it comes to the upload functions on windows
> boxes. I'm trying to fix that, and I know the answer lies somewhere in
> binmode(), and I've tried putting it everywhere that seems logical and I
can
> not get it to work right :(
>
> Can anyone please take a look at this and give me a hand? The problem I
> know is CRLF, because I hex compared a working pic to a corrupted one
> uploaded through the script and it inserted junk CRLF bytes into it. The
> script is Elite Webpage Builder, avalible at
> http://www.elitehosts.com/scripts/builder.zip . Thank you in advance....
>
The link you gave is no good..
To my experience with Acive State Perl (WIN2000); normal mode converts NL CR
to "\n" and stops at certain ASCII control character like FS and RS.
If you turn on binary-mode you will really get every character, mind however
that something like \n will do you no good any longer; use \x0d and \x0a
instead as appropriate...
Kindly Mike
------------------------------
Date: Sat, 25 Jan 2003 09:03:45 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: binmode() please help me
Message-Id: <RpsY9.788$Ec.540@nwrddc02.gnilink.net>
[Please do not post Jeopardy style; posting repaired]
Adam Trotter wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:MPqY9.480$3E6.246@nwrddc01.gnilink.net...
>> Adam Trotter wrote:
>>> I'm trying to modify a perl script for my college's net admin....
>>> most of it works right, except for when it comes to the upload
>>> functions on windows boxes. I'm trying to fix that, and I know the
>>> answer lies somewhere in binmode(), and I've tried putting it
>>> everywhere that seems logical and I can not get it to work right :(
>>
>> What exactly is unclear with the second paragraph of the binmode man
>> page and needs improvement?
>
> I understand that you have to use binmode on windows systems when you
> read from and write to binary data,
You should use binmode on any OS when reading/writing non-text data.
Otherwise you may get into trouble with Perl 5.8.
> I've spent a LOT of time the past
> few days reading pages and pages of stuff about binmode, I just
> haven't gotten any luck in getting what I've read to work in the
> script.
Ok, I'll read the man page to you:
binmode() should be called after open() but before any I/O is
done on the filehandle.
Which part of this is unclear?
> It works fine in my linux server, but on both my XP Pro PC or the
> school's Win2K webserver, file uploads get corrupted because of
File upload??? Are you talking about FTP by any chance?
Perl's binmode function has nothing to do with FTP.
To transfer data in binary mode via FTP you have to set the FTP connection
to binary.
Check you FTP client about how to do that.
To get back on topic for the NG: documentation for the Perl FTP client
Net::FTP can be found in the usual place: "perldoc Net::FTP"
jue
------------------------------
Date: Sat, 25 Jan 2003 08:15:44 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Global
Message-Id: <3e3245a2.57043106@news.erols.com>
"webmaster" <ntk00@hotmail.com> wrote:
: Hello, I'm a beggining perl programmer and have a perl script that has
: this segment of code:
:
: BEGIN {
: $Global::Some_Variable= 1;
:
: [snip]
: }
:
: What is this package $Global?
The package name is "Global", not "$Global".
"$Global::Some_Variable" is the scalar "$Some_Variable" in that
package.
"Global" is just a name. It has no special meaning.
------------------------------
Date: 25 Jan 2003 00:06:43 -0800
From: Markus.Elfring@web.de (Markus Elfring)
Subject: Re: How can a SMTP mail be deleted from a Unix mailbox by a script?
Message-Id: <40ed1d8f.0301250006.589d9810@posting.google.com>
> Bill, over an RFC1149 gateway.
Do you really suggest the "Standard for the Transmission of IP
Datagrams on Avian Carriers" as a gateway service? ;-)
- http://ietf.org/rfc/rfc1149.txt
- Let us perform the POP3 protocol with birds
http://www.blug.linux.no/rfc1149/
------------------------------
Date: 25 Jan 2003 00:49:35 -0800
From: Markus.Elfring@web.de (Markus Elfring)
Subject: Re: How can a SMTP mail be deleted from a Unix mailbox by a script?
Message-Id: <40ed1d8f.0301250049.5d6a012c@posting.google.com>
Correction/update of my reference:
Internet Message Format (Obsoletes: 822)
http://ietf.org/rfc/rfc2822.txt
------------------------------
Date: Fri, 24 Jan 2003 21:55:32 -0900
From: "Tim Judd" <tjudd.01@hotmail.com>
Subject: Perl 5.8.0
Message-Id: <v34cqjkrhqct99@corp.supernews.com>
I'm sorry to double post, but nobody responded to my query.
I can't get the test POSIX to pass (fails at #11), and I'm building it for
use with mod_perl
I took these steps:
1) removed any "config.sh" and "Policy.sh" in the root of the source distro.
2) configure -des -Dusethreads
3) make
4) make test
1, 2, and 3 all succeed w/out a problem.
#4 fails ONLY at POSIX test #11
What to do?
Thanks in Advance
Reply to NG please
--TJ
------------------------------
Date: 25 Jan 2003 10:05:11 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Perl 5.8.0
Message-Id: <b0tngn$5s$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Tim Judd:
> I'm sorry to double post, but nobody responded to my query.
>
> I can't get the test POSIX to pass (fails at #11), and I'm building it for
> use with mod_perl
>
> I took these steps:
> 1) removed any "config.sh" and "Policy.sh" in the root of the source distro.
> 2) configure -des -Dusethreads
> 3) make
> 4) make test
>
> 1, 2, and 3 all succeed w/out a problem.
> #4 fails ONLY at POSIX test #11
I don't have anything to contribute on the matter itself, but you might
want to contact the perl5-porters <mailto:perl5-porters@perl.org> with your
problem. They are the people developping new perl versions and they
therefore might know why the above fails or whether it may perhaps be
ignored.
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: Fri, 24 Jan 2003 23:04:07 -0700
From: "Rod" <palladium@spinn.net>
Subject: Re: Perl Golf on my Mind
Message-Id: <v34aot6angr78d@corp.supernews.com>
"Uri Guttman" <uri@stemsystems.com> wrote in message > that is known as a
quine and you can search google for perl and quine
> and find a bunch of hits on this.
>
To Add on to Uri's excellent response.
I use the CPAN module Quine . Seems to work quite well for my use.
HTH,
Rodney
------------------------------
Date: Sat, 25 Jan 2003 01:02:55 -0500
From: "Thomas Brooks" <tombrooks.nospam@hotmail.com>
Subject: PHP execute perl script
Message-Id: <t6CdndiBBN4Sta-jXTWc3w@comcast.com>
I am running a PHP script which exec a perl script which uses expect. But
when I load the php over the web it just sits there... is it possible to use
expect in this fashion, or does it only work if you are running it from a
shell?
------------------------------
Date: Sat, 25 Jan 2003 02:00:36 -0500
From: "Thomas Brooks" <tombrooks.nospam@hotmail.com>
Subject: Re: PHP execute perl script
Message-Id: <hdqcnZ6JYvqIq6-jXTWcqA@comcast.com>
I think the problem boils down to not being root while running the script.
How can I set this up?
"Thomas Brooks" <tombrooks.nospam@hotmail.com> wrote in message
news:t6CdndiBBN4Sta-jXTWc3w@comcast.com...
> I am running a PHP script which exec a perl script which uses expect. But
> when I load the php over the web it just sits there... is it possible to
use
> expect in this fashion, or does it only work if you are running it from a
> shell?
>
>
------------------------------
Date: Sat, 25 Jan 2003 08:06:05 GMT
From: "Mihai N." <nmihai_2000@yahoo.com>
Subject: Re: Reading French-Accented Data
Message-Id: <Xns930E10A18C79MihaiN@204.127.199.17>
> So, I've established that the character Mappings are as follows, using
> the link
> http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP437.TXT as:
...
> This should, in theory, give me an appropriate mapping of the
> characters (right?)
How did you decided you are dealing with 437?
First: if "data is coming from a windows source", the most probable
encoding is 1252, not 437 (which is a DOS encoding).
Second: on what platform are you runnig the script? Windows?
If you open the afile.txt in Notepad, it looks ok?
> my $fileName = 'afile.txt';
...
> $decChar = ord(substr($line,$i,1));
...
> chr(hex($charMap{$hexChar}))
-----------------
ord:
Returns the numeric (the native 8-bit encoding, like ASCII or EBCDIC, or
Unicode) value of the first character of EXPR.
Note NATIVE!!! On a Russian Windows will use the the 1251 encoding and so
on. Here is where it matters "on what platform you are running the script"
Same with the reverse one, chr.
-----------------
since c = chr(ord(c)), independent of encoding, using %charMap will only
mess thing up (as you can see).
What do you whant to do?
Unless you don't answer some basic questions, nobody can help you
(and I will stop trying)
Mihai
------------------------------
Date: Sat, 25 Jan 2003 14:11:07 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Reading French-Accented Data
Message-Id: <Pine.LNX.4.53.0301251352590.14568@lxplus074.cern.ch>
On Jan 24, Dave Fraleigh inscribed on the eternal scroll:
> So, I've established that the character Mappings are as follows,
As I tried to make clear in my earlier reply: I don't think we really
yet know what your problem is or what you are trying to achieve. I
may have shown one piece of the puzzle, by demonstrating that a byte
of value xC7 could mean upper-case C-cedilla in some 8-bit codings,
while meaning that particular box-drawing character in cp-437. So
far, so good. But it's sheer guesswork how that fits into your big
picture.
Trouble is, you're having some low-level problems that you evidently
need some help with - fair enough - but you tried to describe them
with a broad-brush picture that leaves the details still uncertain.
For all that I can tell, you might be displaying correct iso-8859-1
data in a DOS window - or a terminal emulation - which implements
cp-437 and thus presents the 'wrong' characters even though the data,
if interpreted as iso-8859-1, would be correct.
On top of that, your attempts to describe the problem seem to have
generated this unsolicited &#number; notation in some way that I don't
understand. We need you to write some words about your problem
situation saying precisely what you did and what you observed (and
hopefully, what you expected to observe) if we're to get any further.
And print out the data in hexadecimal so that there can be no doubt
about what it is.
I'm not saying there's anything wrong with your code mapping (although
there -are- pre-written modules for doing that), I'm just saying that
I don't yet know if it's a proper part of a solution to your problem,
because I don't yet really know what the problem is.
Don't forget that if you propose to process the individual bytes of
input data then you should use binmode()
------------------------------
Date: 25 Jan 2003 13:30:52 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reverse Inheritance?
Message-Id: <b0u3ic$hll$1@mamenchi.zrz.TU-Berlin.DE>
Abigail <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMCDXXX
> September MCMXCIII in <URL:news:b0je3n$f96$4@mamenchi.zrz.TU-Berlin.DE>:
> || Malte Ubl <ubl@schaffhausen.de> wrote in comp.lang.perl.misc:
> || > Anno Siegel wrote:
> || > > Ben Morrow <mauzo@mimosa.csv.warwick.ac.uk> wrote in comp.lang.perl.misc:
> || > >
> || > >
> || > >> eval "require $backend";
> || > >> $@ and die $@;
> || > >
> || > >
> || > > I'd rather avoid string eval here and write
> || > >
> || > > require "$backend.pm";
> || >
> || > Just out of curiosity: Why?
> ||
> || Well, string eval is a potentially dangerous operation and requires
> || careful checking of the string(s) involved. So it's a stumbling block
> || in the way of anyone reading the program.
>
> But since you create $backend yourself, without any user supplied code,
> this isn't dangerous at all.
Okay, but you must make sure it isn't. Between tied variables and
overloaded values there are sneaky ways even in superficially harmless
code.
> || Also, it is huge overkill to start another interpreter run just
> || to load a module.
>
> Come again? How do you think Perl knows what to do with the code
> in "$backend.pm"? Divine mindsight? You already need an interpreter
> to compile the content of the code in "$backend.pm".
You mean, if I'm going to call it once I may as well call it twice?
I guess you're right. Ben Morrow has pointed this out too.
> BTW, note that 'require "$backend.pm"' is going to fail if $backend
> contains 'Foo::Whatever'. You'd have to parse $backend, and substitute
> the right path separator for '::'.
True. I didn't nocice this introduces a system-dependency. Why can't
we just all get along and use Unix... :)
> || While efficiency is no concern in this case,
> || it is good engineering to do things with as little expenditure
> || as possible.
>
> You haven't convinced me your in Perl parsing for $backend outweights
> the in C dealing with the eval.
Well, after this discussion it appears that string-evaled require is
indeed the most expedient way to load a module chosen at run time.
I still don't like it.
Anno
------------------------------
Date: 25 Jan 2003 09:54:47 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: unlink()
Message-Id: <b0tmt7$t1f$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Tad McClellan:
> Andrew Lee <AndrewLee> wrote:
>> On Fri, 24 Jan 2003 12:45:52 GMT, helgi@decode.is (Helgi Briem) wrote:
>>>Using my very own Plonk::Warrior module.
>>
>> Are you going to put that on CPAN? I volunteer to be a beta tester.
>
>
> It should be generalized a bit before being uploaded, and renamed:
>
> Plonk::Wannabe
>
> or
>
> Plonk::ScriptKiddie
>
> perhaps?
Those could be modelled as subclasses.
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: Sat, 25 Jan 2003 13:18:30 +0100
From: "Michael Peuser \(h\)" <post@mpeuser.de>
Subject: Re: Where to find documentation for syntax on "if"?
Message-Id: <b0tv8n$k6v$03$1@news.t-online.com>
"J. F. Cornwall" <JCornwall@cox.net> schrieb im Newsbeitrag
news:mMlY9.43104$1b.17762@news1.central.cox.net...
> Jürgen Exner wrote:
> > James F. Cornwall wrote:
> > [...]
> >
> Thank you, everyone, for the pointers and explanations. I'll see if I
> can get my bosses to spring for a better book, that's just the one I
> have currently available. I'll look at the online docs now that I have
> an idea *where* to look in them. As far as the scripts go, I inherited
> them, but I am supposed to clean them up so I appreciate the suggestions
> everyone made.
Although this thrtead is more or less closed I have to add this:
I cannot estimate how much your "bosses" pay you but I am sure you will need
MUCH more time to maintain those programms with your up to now limited
knowledge of Perl. Perl is fine if you use it for new programs - you will
learn step by step. Reading other people's programs will need a LOT of
experience, because Perl is NOT like FORTRAN. Buy a book, read a tutorial,
write 3 programs. Then turn back to your work. You can do it in 10% of the
time....
Kindly Mike
------------------------------
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 4465
***************************************