[19400] in Perl-Users-Digest
Perl-Users Digest, Issue: 1595 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 23 09:05:31 2001
Date: Thu, 23 Aug 2001 06: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)
Message-Id: <998571910-v10-i1595@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 23 Aug 2001 Volume: 10 Number: 1595
Today's topics:
Re: Accessing $a and $b in conjunction with goto &NAME (Anno Siegel)
Re: Accessing anonymous hash inside array?? (Anno Siegel)
Re: Accessing anonymous hash inside array?? <Tassilo.Parseval@post.rwth-aachen.de>
Re: Accessing anonymous hash inside array?? (Anno Siegel)
Re: Accessing anonymous hash inside array?? <Tassilo.Parseval@post.rwth-aachen.de>
Re: Accessing anonymous hash inside array?? (Anno Siegel)
Re: annoying habit of perl 5 in freebsd (Villy Kruse)
Re: elegant substitutions <krahnj@acm.org>
Re: elegant substitutions <krahnj@acm.org>
Re: elegant substitutions <jonni@ifm.liu.nospam.se>
Encode/Decode: how to determine format? <gam1tci@mpinet.net>
Re: Encode/Decode: how to determine format? <ilya@martynov.org>
Re: Error in a if.elsif construction <somewhere@in.paradise.net>
Re: Error in a if.elsif construction <Tassilo.Parseval@post.rwth-aachen.de>
Re: Error in a if.elsif construction (Anno Siegel)
Re: Error in CGI Application: Can't open perl script"d <philippe.perrin@sxb.bsf.alcatel.fr>
Re: Extracting Blocks of text (flii)
Frustrated:Need help installing <borgehaga@hotmail.com>
is perl an 'interpretative' language? (Joachim Ziegler)
Re: Loading up a program asociated with a file <Pcmann1@btinternet.com>
Re: Multiple field seperators with split() <samneric@tigerriverOMIT-THIS.com>
Re: New to group - I'll start with a question (Anno Siegel)
Re: Openning a file (Anno Siegel)
Re: Openning a file <Tassilo.Parseval@post.rwth-aachen.de>
Re: Partial matching of a regular expression (Ian Boreham)
Re: Partial matching of a regular expression (Ian Boreham)
Re: Perl OO needs the opposite of SUPER:: <nospam-abuse@ilyaz.org>
Re: Possible perl/DOS bug? <jeff@vpservices.com>
Re: Possible perl/DOS bug? <jeff@vpservices.com>
RE:State of Parrot (was:FAQ: What is perl6?) <qvyht@removejippii.fi>
Trailing string removal <jocke30_gbg@hotmail.com>
Re: Trailing string removal <em@online.no>
Re: Trailing string removal (Clemens Heidinger)
Re: Trailing string removal <davidhilseenews@yahoo.com>
Re: Why wont this work!?!?!? <Thomas@Baetzler.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Aug 2001 12:36:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Accessing $a and $b in conjunction with goto &NAME
Message-Id: <9m2tbo$19p$1@mamenchi.zrz.TU-Berlin.DE>
According to W. James Showalter, Jr. <gamma@mintaka.iern.disa.mil>:
> Hello,
>
> I am using perl 5.6.0 on Solaris 8.
> Here is a fragment of a subroutine I use for sorting dotted values
> (e.g. OIDs and IP addresses). It resides in a library package.
>
> sub ipsort {
> my $pkg = (caller)[0];
> my @a = split(/\./, ${"$pkg\::a"});
Are you not running under strict? ${"$pkg\::a"} is a symref.
> my @b = split(/\./, ${"$pkg\::b"});
> # remainder of code
> }
>
> Rather than come up with a more generic name I wanted it to be
> able to be called by the name 'oidsort'. So I put the following in
> the same package as ipsort.
>
> sub oidsort {
> goto &ipsort;
> }
>
> However, this did not work even though the calling package name
> was correctly determined in the actual sub 'ipsort'. The errors
> indicated that $a and $b were not initialized.
Ugh. I get a segfault. It must be a bug.
> My ultimate solution was to use
>
> *oidsort = \&ipsort;
>
> which is probably more efficient anyway. But I would appreciate an
> explanation as to why my first "solution" did not work.
I don't think there *is* an explanation. In the name of efficiency
the sort routine bypasses some of the normal setup when it is called.
"goto &sub" is also "highly magical" and probably assumes a lot about
how its originator is set up. I'm not too surprised, but like you,
I would have expected your approach to work.
Anno
------------------------------
Date: 23 Aug 2001 09:07:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Accessing anonymous hash inside array??
Message-Id: <9m2h4l$hhh$1@mamenchi.zrz.TU-Berlin.DE>
According to Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>:
> Carlos C. Gonzalez wrote:
[...]
> > my $hashref = \%{$data[0]};
>
> my $hashref = $data[0]; # it is already a hash-ref
This is one of the "false idioms" one sees quite a bit. At least one
CPAN module does it regularly. While it is functionally a no-op[1],
it is a stumbling block for human readers. Not only will it make them
read twice this particular bit of code, but knowing that the author
isn't always sure what he's doing, they will have to read the rest of
the program at reduced speed.
Anno
[1] It isn't always a no-op. If $x happens to be an object that
overloads @{}, \@$x will in general be different from $x.
------------------------------
Date: Thu, 23 Aug 2001 11:19:53 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Accessing anonymous hash inside array??
Message-Id: <3B84CAB9.2090500@post.rwth-aachen.de>
Anno Siegel wrote:
> [1] It isn't always a no-op. If $x happens to be an object that
> overloads @{}, \@$x will in general be different from $x.
Honestly, this would account for super-obfuscation. Overloading the
dereference-operator and instantly referencing the return-value whatever
it eventually may be.
I wonder whether ever an unsatisfied programmer in a company has written
a program that overloads '+' with '-' etc....that is: permuting some
operators as a mischievous joke. Hmmh, I think I have an idea for a new
JAPH. :-)
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: 23 Aug 2001 10:21:29 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Accessing anonymous hash inside array??
Message-Id: <9m2lf9$nk7$1@mamenchi.zrz.TU-Berlin.DE>
According to Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>:
> Anno Siegel wrote:
>
> > [1] It isn't always a no-op. If $x happens to be an object that
> > overloads @{}, \@$x will in general be different from $x.
>
> Honestly, this would account for super-obfuscation. Overloading the
> dereference-operator and instantly referencing the return-value whatever
> it eventually may be.
It's non-obvious for sure, but it's the only context I know where
\@$x might make sense. If @$x is overloaded, what it returns may
depend on the phase of the moon. \@$x would serve to freeze one
phase in an ordinary arrayref.
> I wonder whether ever an unsatisfied programmer in a company has written
> a program that overloads '+' with '-' etc....that is: permuting some
> operators as a mischievous joke. Hmmh, I think I have an idea for a new
> JAPH. :-)
The possibility of overloading dereferencing, which I incidentally
discovered only a few weeks ago, is in fact a minor revolution. It
gives Perl objects another dimension of polymorphism: Use it as an
arrayref, and it is an arrayref. It also means that "@$obj" is no
longer (necessarily) a breach of encapsulation, because the class
can contain an interface for it. This can make neat interfaces.
It has been said that an advantage of OO is that it allows old code to
use new code. This is true if the old code is new enough to be object
oriented itself. With deref overloading, you can make old code use
new code if the old code only does dereferencing.
All this sounds perhaps more promising than it is. Let my just say
that the call to the overloading code is wedged, as it were, between
the "@" and the "$" in @$x. This is not a very comfortable place.
Anno
------------------------------
Date: Thu, 23 Aug 2001 12:45:03 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Accessing anonymous hash inside array??
Message-Id: <3B84DEAF.2070400@post.rwth-aachen.de>
Anno Siegel wrote:
> The possibility of overloading dereferencing, which I incidentally
> discovered only a few weeks ago, is in fact a minor revolution. It
> gives Perl objects another dimension of polymorphism: Use it as an
> arrayref, and it is an arrayref. It also means that "@$obj" is no
> longer (necessarily) a breach of encapsulation, because the class
> can contain an interface for it. This can make neat interfaces.
>
> It has been said that an advantage of OO is that it allows old code to
> use new code. This is true if the old code is new enough to be object
> oriented itself. With deref overloading, you can make old code use
> new code if the old code only does dereferencing.
>
> All this sounds perhaps more promising than it is. Let my just say
> that the call to the overloading code is wedged, as it were, between
> the "@" and the "$" in @$x. This is not a very comfortable place.
But probably the only way of sensibly achieving that.
The overload-pragma isn't that often used, as for now. I am just waiting
for the first modules that implement a whole new way of looking at
things. Assuming a class and an instantiation of the class $obj, you can
do surprising things. Give this class a global, $STACK and you could say:
$obj--; # will remove $STACK
$obj++; # will add it
"$obj"; # interpretate $obj as address
I think you could transform the Perl interpreter into an interpreter of
an assembly language...useful for writing computer emulations such as
MMIX. You would no longer need a parser for that.
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: 23 Aug 2001 11:34:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Accessing anonymous hash inside array??
Message-Id: <9m2pnr$rdt$1@mamenchi.zrz.TU-Berlin.DE>
According to Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>:
> Anno Siegel wrote:
>
> > The possibility of overloading dereferencing, which I incidentally
> > discovered only a few weeks ago, is in fact a minor revolution. It
> > gives Perl objects another dimension of polymorphism: Use it as an
> > arrayref, and it is an arrayref. It also means that "@$obj" is no
> > longer (necessarily) a breach of encapsulation, because the class
> > can contain an interface for it. This can make neat interfaces.
> >
> > It has been said that an advantage of OO is that it allows old code to
> > use new code. This is true if the old code is new enough to be object
> > oriented itself. With deref overloading, you can make old code use
> > new code if the old code only does dereferencing.
> >
> > All this sounds perhaps more promising than it is. Let my just say
> > that the call to the overloading code is wedged, as it were, between
> > the "@" and the "$" in @$x. This is not a very comfortable place.
>
> But probably the only way of sensibly achieving that.
>
> The overload-pragma isn't that often used, as for now. I am just waiting
> for the first modules that implement a whole new way of looking at
> things. Assuming a class and an instantiation of the class $obj, you can
> do surprising things. Give this class a global, $STACK and you could say:
>
> $obj--; # will remove $STACK
> $obj++; # will add it
> "$obj"; # interpretate $obj as address
Not sure what you're getting at here? $obj-- will remove the whole
stack? Or pop one item? Interpret "$obj" as an address doesn't make
any sense to me without context.
> I think you could transform the Perl interpreter into an interpreter of
> an assembly language...useful for writing computer emulations such as
> MMIX. You would no longer need a parser for that.
I don't know about MMIX, but overloading can certainly help to use
the Perl parser where you otherwise would have to write your own.
Say you have a perl shell "print eval <STDIN> while 1" (or something
a leetle more sophisticated) that works, among other things, like
a desk calculator that evaluates arbitrary expressions. Load
Math::Complex (which overloads arithmetic appropriately) and your
calculator now does arbitrary expressions involving complex numbers.
Anno
------------------------------
Date: 23 Aug 2001 08:28:12 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: annoying habit of perl 5 in freebsd
Message-Id: <slrn9o9fks.s80.vek@pharmnl.ohout.pharmapartners.nl>
On Wed, 22 Aug 2001 17:51:16 GMT,
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "JJT" == John J Trammell <trammell@haqq.hypersloth.invalid> writes:
>
> JJT> On Thu, 23 Aug 2001 01:36:54 +0800, JH Foo <foojh@hotmail.com> wrote:
> >> It seems that Perl on Freebsd (4.3) has this annoying habit:
>
> JJT> It's not a Perl thing, and it's not (just) a FreeBSD thing.
> JJT> It's a *nix thing. One solution is:
>
> JJT> print STDERR "x";
>
>or make stdout autoflush:
>
> $|++ ;
Actualy I would do $|=1; . If you want to set it to one just say so.
No need to fetch the preveious value (whatever that might be) and
increment it.
BTW, $| is magic and can only have the values 0 and 1 regardless what
value you assign to it.
Villy
------------------------------
Date: Thu, 23 Aug 2001 07:16:49 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: elegant substitutions
Message-Id: <3B84AE44.820B125C@acm.org>
Just in wrote:
>
> I can get the following to work, with some splits and substitutions
> but the code runs into several lines . . . this in itself isn't so bad
> but there's a better way to do it, and while I have been trying
> I'm not getting what I want.
>
> Here's the low down:-
>
> A particular variable could have any of the following combinations
> plus others:
>
> 61[02,02,04] which needs to be interpreted as 6102, 6103, 6104
> 7[20,30]6 which needs to be interpreted as 7206, 7306
> [EA,BA]T which needs to be interpreted as EAT, BAT
> blah blah blah
>
> How can I get a one line substitution to work?
my @orig = ( '61[02,02,04]', '7[20,30]6', '[EA,BA]T' );
my @new;
for my $x ( @orig ) {
( $a = $x ) =~ s/^(.*)\[.*](.*)$/$1$_$2/ and push @new, $a for $x =~
/(?:\[|,)([^,\]]+)(?=,|])/g;
}
print "@orig\n@new\n";
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 23 Aug 2001 08:55:29 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: elegant substitutions
Message-Id: <3B84C56C.AC600EF4@acm.org>
Michael Budash wrote:
>
> In article <9m24ml$h34@news.or.intel.com>, "Just in"
> <justin.devanandan.allegakoen@intel.com> wrote:
>
> > I can get the following to work, with some splits and substitutions
> > but the code runs into several lines . . . this in itself isn't so bad
> > but there's a better way to do it, and while I have been trying
> > I'm not getting what I want.
> >
> > Here's the low down:-
> >
> > A particular variable could have any of the following combinations
> > plus others:
> >
> > 61[02,02,04] which needs to be interpreted as 6102, 6103, 6104
> > 7[20,30]6 which needs to be interpreted as 7206, 7306
> > [EA,BA]T which needs to be interpreted as EAT, BAT
> > blah blah blah
> >
> > How can I get a one line substitution to work?
>
> one way:
>
> s|^(.*?)\[(.+)\](.*?)$|join(",",map{"$1$_$3"}(split(/,/,$2)))|e;
s|^(.*)\[(.*)](.*)$|"@{[map{$1.$_.$3}split/,/,$2]}"|e;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 23 Aug 2001 13:37:47 +0200
From: "Jonas Nilsson" <jonni@ifm.liu.nospam.se>
Subject: Re: elegant substitutions
Message-Id: <9m2pl6$jar$1@newsy.ifm.liu.se>
A suggestion to make it work for things like:
8,12[2,3,4],5[12,24]6,9 => 8,123,123,124,5126,5246,9
> "Michael Budash" <mbudash@sonic.net> wrote in message
> s|^(.*?)\[(.+)\](.*?)$|join(",",map{"$1$_$3"}(split(/,/,$2)))|e;
s!\b([^, ]*)\[([^\]]*)\]([^, ]*)!join',',map"$1$_$3",split',',$2!ge;
--
/jN
------------------------------
Date: Thu, 23 Aug 2001 11:55:08 GMT
From: Gary <gam1tci@mpinet.net>
Subject: Encode/Decode: how to determine format?
Message-Id: <3B84EEC3.5DB7@mpinet.net>
Someone has sent me a boatload of JPG images which I need to use
in a script I am writing (actually these images are for the "Tk"
aspect of the program). However, they didn't send them as
JPG attachments, instead they arrived as "text" lines, with:
begin NUMBER filename.jpg
many lines consisting of 61 characters and a newline each
beginning with the character M
end
I realize they're encoded, but how does one determine how they're
encoded? I have searched deja and perldocs, and there is plenty of
information on the subject of encoding/decoding MIME, base64,
uuencode, etc., but how can I determine what the encoding is
that's in these text files?
------------------------------
Date: 23 Aug 2001 15:59:28 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Encode/Decode: how to determine format?
Message-Id: <87d75ndm1r.fsf@abra.ru>
>>>>> On Thu, 23 Aug 2001 11:55:08 GMT, Gary <gam1tci@mpinet.net> said:
G> Someone has sent me a boatload of JPG images which I need to use
G> in a script I am writing (actually these images are for the "Tk"
G> aspect of the program). However, they didn't send them as
G> JPG attachments, instead they arrived as "text" lines, with:
G> begin NUMBER filename.jpg
G> many lines consisting of 61 characters and a newline each
G> beginning with the character M
G> end
G> I realize they're encoded, but how does one determine how they're
G> encoded? I have searched deja and perldocs, and there is plenty of
G> information on the subject of encoding/decoding MIME, base64,
G> uuencode, etc., but how can I determine what the encoding is
G> that's in these text files?
AFAIK it is uuencode.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Thu, 23 Aug 2001 19:22:07 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: Error in a if.elsif construction
Message-Id: <iY3h7.38$j12.471137@news.interact.net.au>
"Tassilo von Parseval" <Tassilo.Parseval@post.rwth-aachen.de> wrote in
message news:3B84258C.4050103@post.rwth-aachen.de...
> Nomade wrote:
>
> > Hi all,
> >
> > syntax error at ./check_log.pl line 37, near "}"
> > syntax error at ./check_log.pl line 40, near "}"
> > Execution of ./check_log.pl aborted due to compilation errors.
> >
> >
> > In the following piece of code i get the above error return, line 37
> > is the elsif statement... :
> >
> >
> > if ( scalar @err_grep == 0 && $err_counter == 14 || $err_counter == 18
> > || $err_counter == 24 || $err_counter == 25 || $err_counter == 60 )
> > {
> > print ("SAP - $err_counter on $current_log") ;
> > }
> > elsif ( scalar @err_grep == 0 && $err_counter == 59 || $err_counter ==
> > (47..54)
> ^^^
> Something missing in the above line, isn't there?
> Hint: Count the left- and right-parens.
If the OP used decent indentation, it would have been pretty obvious.
------------------------------
Date: Thu, 23 Aug 2001 11:34:59 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Error in a if.elsif construction
Message-Id: <3B84CE43.2040901@post.rwth-aachen.de>
Tintin wrote:
> If the OP used decent indentation, it would have been pretty obvious.
*sigh*
And yet, some people still don't use them. Of course, even with
indentation, programming would not be error-proof. But it would
certainly be more fun since understanding and keeping track of the
logic-flow of _one's own_ program is sometimes quite nice. ;-)
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: 23 Aug 2001 09:42:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Error in a if.elsif construction
Message-Id: <9m2j72$lgp$1@mamenchi.zrz.TU-Berlin.DE>
According to Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>:
> Nomade wrote:
>
> > Hi all,
> >
> > syntax error at ./check_log.pl line 37, near "}"
> > syntax error at ./check_log.pl line 40, near "}"
> > Execution of ./check_log.pl aborted due to compilation errors.
> >
> >
> > In the following piece of code i get the above error return, line 37
> > is the elsif statement... :
> >
> >
> > if ( scalar @err_grep == 0 && $err_counter == 14 || $err_counter == 18
> > || $err_counter == 24 || $err_counter == 25 || $err_counter == 60 )
> > {
> > print ("SAP - $err_counter on $current_log") ;
> > }
> > elsif ( scalar @err_grep == 0 && $err_counter == 59 || $err_counter ==
> > (47..54)
> ^^^
> Something missing in the above line, isn't there?
> Hint: Count the left- and right-parens.
That'd be the syntax error. But "$err_counter == (47..54)" is made up
from whole cloth itself. Presumably the idea is that it works like
"47 <= $err_counter and $err_counter <= 54", but except perhaps under
Quantum::Superposition it doesn't. Guessing syntax one isn't sure
of is fine, but stuffing it in a larger program without confirmation
is stupid.
A minor point: "scalar" is unnecessary in "scalar @err_grep == 0".
Anno
------------------------------
Date: Thu, 23 Aug 2001 08:51:28 +0200
From: Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr>
Subject: Re: Error in CGI Application: Can't open perl script"d:\myfolder\myfolder\: No such file or directory.
Message-Id: <3B84A7F0.ACF51DA3@sxb.bsf.alcatel.fr>
Ash Turner wrote:
> App Mapping the correct path c:\perl\bin\perl.exe %s %s
I don't know it it can help, but my mapping is :
...perl.exe "%1" %*
--
PhP
($r1,$r2,$r3,$r4)=("19|20","0|1","28|29","5|24");($r5,$r6)=("9|10|15|16|$r1|$r2","9|10|$r3");%h=("1|",$r6,"1=","[1-5]|2[0-4]","1/","0|19","1\\","6|25","2|","0|6|19|25|$r6","2/","1|20","2\\",$r4,"3|","$r2|6|$r1|25|$r6","3/",$r4,"4|","$r2|$r1|$r6","4=","2|3|4|11|12|13|14|21|22|23","4/",$r4,"4\\",15,"5|","$r2|9|15|$r1|20|$r3","5/",10,"6|",$r5,"7|",$r5,"7/",$r3);for($l=1;$l<8;$l++){b:for($i=0;$i<30;$i++){c:foreach(keys
%h){next c if(!(/^$l(.*)$/));$a=$1;if($i=~/^($h{$_})$/){print $a;next
b;}}print " ";}print "\n";}
------------------------------
Date: 23 Aug 2001 02:44:06 -0700
From: flii@zoom.co.uk (flii)
Subject: Re: Extracting Blocks of text
Message-Id: <e53f8197.0108230144.5d46e6bc@posting.google.com>
Thanks guys for the help...
As soon as the '..' operator was mentioned, I found the relevant
chapter in the O'Reilly Perl Cookbook, which described exactly what I
was after - not sure how I missed it, snowblindness during the English
summer, probably!
------------------------------
Date: Thu, 23 Aug 2001 11:16:16 +0200
From: "Boerge Haga" <borgehaga@hotmail.com>
Subject: Frustrated:Need help installing
Message-Id: <PR3h7.4936$hc7.63458@news1.oke.nextra.no>
I'm installing Perl on a PC running an old version of Red Hat Linux (5.1).
Version 5.004 of Perl was included in the installation. In addition I need
to install LWP and MD5.
I tried to install MD5 some days ago and I thought I was succesful, but
I'm not entirely sure.
Now I'm trying to install LWP but am running into problems.
I have tried to install using the "perl -MCPAN -e shell" command, but
I'm running into problems when I'm supposed to enter a favourite URL.
I get this "doesn't seem to work" message when I try to enter a URL
(like ftp://ftp.uninett.no/pub/languages/perl/CPAN).
So I have tried fetching modules and doing all the gzip,tar,make etc.
That seemed to work for the MD5 modeule even if I'm not 100%
sure it really works.
1) I need the LWP module and have fetched:
libwww-perl-5.53_95.tar.gz
libwww-perl-5.53.tar.gz
The first gives me:
"Can't locate IO/Socket/INET.pm in @INC.........."
...when running "perl Makefile.PL"
The second gives me:
"Checking for URI..........failed
Can't locate URI.pm in @INC........
Checking for HTML::Parser.....failed
Can't locate HTML/HeadParser.pm in @INC.....
Checking for MIME::Base64.....failed
Can't locate MIME/Base64.pm in @INC.....
Checking for Net::FTP....ok
Checking for Digest::MD5...failed (NOTE: I thought I had it installed)
Can't locate Digest/MD5 in @INC.....
...
Writing Makefile for libwww-perl....."
2) Is there a way I can fetch all from the beginning and scrap all
in order to be sure to get everything I need and install everything
in one go? I guess getting the "perl -MCPAN -e shell" to work
would be a plus in order to do this, but I have no clue what I'm
missing?
Boerge
------------------------------
Date: 23 Aug 2001 05:54:34 -0700
From: ziegler@algorilla.de (Joachim Ziegler)
Subject: is perl an 'interpretative' language?
Message-Id: <93aad7d0.0108230454.74dec340@posting.google.com>
hi,
i've recently heard the term 'interpretative language' for the special
combination of a compiler and an interpeter Perl uses to execute
a script.
it is neither a pure compiled language, nor an interpreted, nor is it
the same kind of bytecode-interpetation like Java.
what do you think about calling Perl an 'interpretative language'?
is this the right expression ? i'd like to use it in the future when
talking about Perl.
------------------------------
Date: Thu, 23 Aug 2001 13:40:36 +0100
From: "Peter Mann" <Pcmann1@btinternet.com>
Subject: Re: Loading up a program asociated with a file
Message-Id: <9m2thr$1no$1@neptunium.btinternet.com>
Dear All,
Thanks firstly for the advice! My application will be specific to Windows so
I suspect the "start" command will be fine. However, within my program I
have connected a button to call a sub as follows:
sub load
{
my $url='http://www.perl.com';
system('start',$url);
}
The problem is that as soon as the subroutine is called, my program
stops responding! I have to use task manager to close it. When it has been
terminated, my browser does then load with the contents of the specified web
page.
Does anyone know why this would be?
Thanks in advane
- Regards
- Pete
------------------------------
Date: Thu, 23 Aug 2001 08:40:42 -0400
From: Samneric <samneric@tigerriverOMIT-THIS.com>
Subject: Re: Multiple field seperators with split()
Message-Id: <MPG.15eec3bedc94d4be989692@news.onemain.com>
noms wrote:
> reliability 255/255, txload 1/255, rxload 1/255
>
> I'd like to be able to pull the numerator fields, in this case 255-1-1. I'm
> trying to get those fields using the following split calls ($foo is the
> sample line):
If you use split, you have to filter out what you don't want in the returned
list.
my $line = " reliability 255/255, txload 1/255, rxload 1/255";
my @numerators = $line =~ m!(\d+)/!g;
print "@numerators\n";
*******
225 1 1
------------------------------
Date: 23 Aug 2001 12:50:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: New to group - I'll start with a question
Message-Id: <9m2u6k$19p$2@mamenchi.zrz.TU-Berlin.DE>
According to Mr Q. Z. Diablo <diablo@prometheus.humsoc.utas.edu.au>:
> In article <slrn9o8r88.51f.tadmc@tadmc26.august.net>,
> tadmc@augustmail.com wrote:
> > Mr Q. Z. Diablo <diablo@prometheus.humsoc.utas.edu.au> wrote:
> > >In article <slrn9o8f5c.4nd.tadmc@tadmc26.august.net>,
> > >tadmc@augustmail.com wrote:
[ m/...(...).../ returns the captured parts in list context]
> > >> >inconsistent with the rest of the way that Perl works (to me, anyway).
> >
> > I was questioning your use of "inconsistent" there. To have
> > an inconsistentency, you need 2 things that are "different"
> > in some way.
> >
> > You showed only 1 thing, I was asking for the 2nd thing that
> > behaved somehow differently. Can you give an example?
>
> I would have expected that sort of thing to set the variables $1, $2,
> &c. but do nothing else apart from, perhaps, fill the first scalar. A
> matching operator doesn't (intuitively) evaluate as a list and this
> seemed odd. That's all.
Perl operators are free to behave entirely differently in scalar and
list context (as are subs written in Perl). Any consistency is
purely coincidental. Well, not coincidental, but deliberately designed
into the language.
Anno
------------------------------
Date: 23 Aug 2001 11:10:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Openning a file
Message-Id: <9m2obu$pvu$1@mamenchi.zrz.TU-Berlin.DE>
According to Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>:
> Tad McClellan wrote:
>
> > No, that is what _arrays_ do in scalar context. There are
> > no arrays in the above. This is one of the places where the
> > distinction does matter:
> >
> > Perl FAQ, part 4:
> >
> > "What is the difference between a list and an array?"
>
> Hehe, it has often been referenced to this FAQ-article. I never really
> read it since I thought I knew the difference. But you gave me some
> subtle hints as to the fact that I didn't. ;-)
>
> I also read this bit about the comma-operator in scalar context in
> perlop. There is, however, something I don't quite understand about it.
> It says, the left side of the comma is evaluated and its value thrown
> away. After that, the right-side value is returned. In which way does it
> make sense to evaluate something and then throw it away?
Side effects.
> Does anyone have an example for that?
It isn't used often because in most cases you can separate statements
with ";" to the same effect. But the comma operator makes one big
*expression* of multiple expressions, so it can be used when you want
to do more things in a place where only one statement is expected.
A common case is
for ( $i =0, $k=0; ...) {
Anno
------------------------------
Date: Thu, 23 Aug 2001 13:15:47 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Openning a file
Message-Id: <3B84E5E3.1050507@post.rwth-aachen.de>
Anno Siegel wrote:
[comma operator in scalar context]
>>Does anyone have an example for that?
>>
>
> It isn't used often because in most cases you can separate statements
> with ";" to the same effect. But the comma operator makes one big
> *expression* of multiple expressions, so it can be used when you want
> to do more things in a place where only one statement is expected.
> A common case is
>
> for ( $i =0, $k=0; ...) {
Thanks, Anno. That's a very good example. In fact I was a little dumb
here. perlop explicitely says that it behaves just like the C
comma-operator. And your example is something commonly used in C. I
could have known that if I had tried harder. :-/
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: 23 Aug 2001 01:24:28 -0700
From: ianb@ot.com.au (Ian Boreham)
Subject: Re: Partial matching of a regular expression
Message-Id: <f02c4576.0108230024.e3028b9@posting.google.com>
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in message news:<3b842901@news.victoria.tc.ca>...
> JP Belanger (jpbelang@hotmail.com) wrote:
> print "partial match" if 'hello' =~ m/^${input}$/;
You probably don't want that final "$" there.
Regards,
Ian
------------------------------
Date: 23 Aug 2001 02:44:27 -0700
From: ianb@ot.com.au (Ian Boreham)
Subject: Re: Partial matching of a regular expression
Message-Id: <f02c4576.0108230144.62d83bdd@posting.google.com>
jpbelang@hotmail.com (JP Belanger) wrote in message news:<b399d6ce.0108221305.34490233@posting.google.com>...
> Is there a way in perl to "partially match" on input ?
>
> For example, with expression /hello/ and input "hel", I'd like to know
> that the regular expression is currently matching, but not done yet.
"Partially matching" might not really do what you want it to.
Basically any string will partially match /hello/ - they'll all match
the position before the h, and in a few cases, more than that. I
gather what you would really like is for the string to "partially
match", and for all of the string to be used in the match. That means
that you are really considering patterns of the form /^hello$/ (i.e.
the full string must be able to match the pattern).
If you are happy to use patterns that are basically constant strings,
you can reverse the pattern and string as another poster described
(anchored at the start, but not at the end). I don't know of any
simple way of checking for "partial matches" with more complex
regexes. You might be able to take the pattern as a string to start
with, and then process it to produce a new pattern that itself matches
any "partial match". That would be quite difficult to do in general,
though, considering how baroque perl regexes can get.
You could also process the pattern string to embed code to be executed
during the matching process, to allow you to check at each point if
the whole string had been used, and to set a flag if so. I'll leave
that as an exercise to the reader. There's also some interface to the
regex engine guts around, but I don't recall the name of the module
required to use it (probably "re" or something like that...) - I'm
sure with enough ingenuity that could be used to implement "partial
matches".
Regards,
Ian
------------------------------
Date: Thu, 23 Aug 2001 12:40:32 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Perl OO needs the opposite of SUPER::
Message-Id: <9m2tk0$1042$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
John Lin
<johnlin@chttl.com.tw>], who wrote in article <a73bcad1.0108221715.239a688a@posting.google.com>:
> > package EvenReport;
> > use base 'Report';
> > sub report { "even" }
> >
> > package ExtendedReport; # an abstract "interface"
> > sub report {
> > local *report;
> > "extended " . shift() -> report; # similar to SUPER::report
> > }
This works in toy situations only. Your `local *report' is a global
override, as opposed to an object-specific override. Thus if
shift()->report calls `report' on some *other* objects which are kids
of ExtendedReport, this would break.
Hope this helps,
Ilya
------------------------------
Date: Thu, 23 Aug 2001 04:08:22 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Possible perl/DOS bug?
Message-Id: <3B84E426.B359CB92@vpservices.com>
Jonas Nilsson wrote:
>
> Try out this code changing $mydir to a dir in your dir structure.
>
> use strict;
> my $mydir='D:/Slask/testdir/';
> mkdir($mydir."testdir1../");
> mkdir($mydir."testdir2..\\");
> mkdir($mydir."testdir3");
> opendir(DIR,$mydir);
> for (readdir DIR) {
> printf "%-20s %-20s\n",$_,(-d $mydir.$_?"A dir":"Not a dir");
> };
>
> Reslult:
> . A dir
> .. A dir
> testdir1. Not a dir
> testdir2. Not a dir
> testdir3 A dir
Hmm, works for me on win98 changing only the name of $mydir in your
script:
-- start screendump --
Microsoft(R) Windows 98
(C)Copyright Microsoft Corp 1981-1999.
C:\WINDOWS>d:
D:\htdocs\a\testdir>perl /htdocs/cgi-bin/test_snippets/mkdir.pl
. A dir
.. A dir
testdir1 A dir
testdir2 A dir
testdir3 A dir
D:\htdocs\a\testdir>perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 626 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 01:31:15 May 2 2001
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.
D:\htdocs\a\testdir>
-- end screendump --
--
Jeff
------------------------------
Date: Thu, 23 Aug 2001 04:10:59 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Possible perl/DOS bug?
Message-Id: <3B84E4C3.47046F2D@vpservices.com>
> To 'view' and 'delete' those folder names from
> console (not explorer) you have to view the folders with their 8.3 filename
> format.
> e.g:
>
> dir /x
> rd testdi~2
Or put the name of the dir in quotes:
rd "long name of directory"
--
Jeff
------------------------------
Date: Thu, 23 Aug 2001 12:02:04 GMT
From: Hessu <qvyht@removejippii.fi>
Subject: RE:State of Parrot (was:FAQ: What is perl6?)
Message-Id: <3B84EF8D.E7E2DD6F@removejippii.fi>
Polly still alive and nacking?
------------------------------
Date: Thu, 23 Aug 2001 13:58:14 +0200
From: "JJ" <jocke30_gbg@hotmail.com>
Subject: Trailing string removal
Message-Id: <9m2r2s$2gk$1@vg170.it.volvo.se>
Hi,
I have a basic quiz:
How can I remove the string ".txt" in the string "C:\myFile.txt"
$theFile = "C:\myFile.txt";
....
Regards
Joacim
------------------------------
Date: 23 Aug 2001 14:19:35 +0200
From: Espen Myrland <em@online.no>
Subject: Re: Trailing string removal
Message-Id: <87bsl7otns.fsf@espenboks.ws.nextra.no>
"JJ" <jocke30_gbg@hotmail.com> writes:
> Hi,
>
> I have a basic quiz:
>
> How can I remove the string ".txt" in the string "C:\myFile.txt"
>
> $theFile = "C:\myFile.txt";
> ....
$thefile =~ s/\.txt^//;
--
espen
------------------------------
Date: Thu, 23 Aug 2001 12:21:40 +0000
From: clemens@he.idinger.net (Clemens Heidinger)
Subject: Re: Trailing string removal
Message-Id: <kgs2m9.bs.ln@spoooky.de>
On Thu, 23 Aug 2001 13:58:14 +0200, JJ wrote:
> How can I remove the string ".txt" in the string "C:\myFile.txt"
> $theFile = "C:\myFile.txt";
$theFile = 'C:\myFile.txt';
$theFile =~ s/\.txt//;
------------------------------
Date: Thu, 23 Aug 2001 13:00:03 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: Trailing string removal
Message-Id: <n77h7.9137$hT4.2305937@news1.rdc1.md.home.com>
"JJ" <jocke30_gbg@hotmail.com> wrote in message
news:9m2r2s$2gk$1@vg170.it.volvo.se...
> Hi,
>
> I have a basic quiz:
>
> How can I remove the string ".txt" in the string "C:\myFile.txt"
>
> $theFile = "C:\myFile.txt";
> ....
>
> Regards
> Joacim
>
$theFile =~ s/\.txt$//;
David Hilsee
------------------------------
Date: Thu, 23 Aug 2001 09:38:01 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Why wont this work!?!?!?
Message-Id: <f9c9ot4j9tk3ik51dunpka52q31gjstqm1@4ax.com>
On 22 Aug 2001, aspersion@yahoo.com (Isaac) wrote:
>C:\Inetpub\scripts\test>perl -w test420.pl
>Content-Type: text/html; charset=ISO-8859-1
>
> Range Delay: 11360 meters
>
>C:\Inetpub\scripts\test>
>
>Which is the content of the file......Which is GOOD
>
>But when I access it from a web browser it page comes up BLANK?!?!?!
>No errors whatsoever.
Your script header claims that the output is text/html, but there is
just plain text in the output. Try adding start_html() and end_html()
calls in your code, or output your file as text/plain.
HTH,
--
Thomas Baetzler - http://baetzler.de/ - Clan LoL - http://lavabackflips.de/
I am the "ILOVEGNU" signature virus. Just copy me to your signature.
This post was infected under the terms of the GNU General Public License.
------------------------------
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 1595
***************************************