[30128] in Perl-Users-Digest
Perl-Users Digest, Issue: 1371 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 18 15:11:09 2008
Date: Tue, 18 Mar 2008 11:09:07 -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 Tue, 18 Mar 2008 Volume: 11 Number: 1371
Today's topics:
Re: cannot post message to perl beginners <Peter@PSDT.com>
Re: decrease MAC <josef.moellers@fujitsu-siemens.com>
Re: decrease MAC <jameslockie@mail.com>
Re: FAQ 5.39 Why do I get weird spaces when I print an <tzz@lifelogs.com>
hex to binary <venkatesh.sourav@gmail.com>
Re: hex to binary <josef.moellers@fujitsu-siemens.com>
Re: hex to binary <jurgenex@hotmail.com>
Re: Inside-out objects are slow! (or how to accelerate <koszalekopalek@interia.pl>
Re: Inside-out objects are slow! (or how to accelerate <tzz@lifelogs.com>
Re: Installing a perl module manually on windows <sisyphus359@gmail.com>
Problem with loop control LAST exiting prematurely <hitodenashi@alexandria.cc>
Re: Problem with loop control LAST exiting prematurely <willem@stack.nl>
Re: Problem with loop control LAST exiting prematurely <hitodenashi@alexandria.cc>
Re: Problem with loop control LAST exiting prematurely <someone@example.com>
Re: Problem with loop control LAST exiting prematurely <hitodenashi@alexandria.cc>
Re: Problem with loop control LAST exiting prematurely <hitodenashi@alexandria.cc>
Re: Problem with loop control LAST exiting prematurely xhoster@gmail.com
Re: Problem with loop control LAST exiting prematurely <hitodenashi@alexandria.cc>
Re: Problem with loop control LAST exiting prematurely xhoster@gmail.com
Re: P~(ptilde) 0.9 released, new scripting language wit <ptilderegex@gmail.com>
Source for the open perl function himanshu.garg@gmail.com
Re: Source for the open perl function <ben@morrow.me.uk>
Re: why is return always 0? <ced@blv-sam-01.ca.boeing.com>
Re: why is return always 0? (hymie!)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 Mar 2008 11:37:41 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: cannot post message to perl beginners
Message-Id: <pan.2008.03.18.11.37.40.587416@PSDT.com>
On Mon, 17 Mar 2008 18:17:31 -0500, Tad J McClellan wrote:
> John <john1949@yahoo.com> wrote:
>> This is odd. I can post to this newsgroup but not to perl.beginners.
>
> perl.beginners is not a newsgroup, it is a mailing list (with, perhaps,
> a mail-to-news gateway?).
>
>> Anyone any idea why this is so?
>
> You will need to ask your ISP how to treat it as a newsgroup,
> or use it in a mailing list fashion.
perl.beginners is bidirectionally gatewayed to a newsgroup, I access it
and all the perl.org mailing lists thus. The NNTP server is
nntp,perl.org; see http://www.nntp.perl.org/about/ . An ISP isn't likely
to know this.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Tue, 18 Mar 2008 10:29:32 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: decrease MAC
Message-Id: <fro1vo$21n$2@nntp.fujitsu-siemens.com>
jammer wrote:
> On Mar 17, 4:06 pm, Ben Morrow <b...@morrow.me.uk> wrote:
>> Quoth jammer <jamesloc...@mail.com>:
>>
>>> I have a hex number which is actually a MAC address and I want to find
>>> the MAC immediately before.
>>> 0000AAAA9999
>>> Is there a way to treat it as a hex number and do -1 one on it?
>> my $MAC = '0000AAAA9999';
>> printf "%x\n", hex($MAC) - 1;
>>
>> Ben
>
> What if there are not 4 leading 0s.
> my $MAC = '000BAAAA9999';
> printf "%x\n", hex($MAC) - 1;
> Integer overflow in hexadecimal number
Pragmatic approach: split up into smaller parts, do the math, then
re-assemble.
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Tue, 18 Mar 2008 07:20:37 -0700 (PDT)
From: jammer <jameslockie@mail.com>
Subject: Re: decrease MAC
Message-Id: <8bd5066a-072a-47af-ab83-eaa2a45ff0d6@i12g2000prf.googlegroups.com>
On Mar 18, 5:29 am, Josef Moellers <josef.moell...@fujitsu-
siemens.com> wrote:
> jammer wrote:
> > On Mar 17, 4:06 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> >> Quoth jammer <jamesloc...@mail.com>:
>
> >>> I have a hex number which is actually a MAC address and I want to find
> >>> the MAC immediately before.
> >>> 0000AAAA9999
> >>> Is there a way to treat it as a hex number and do -1 one on it?
> >> my $MAC = '0000AAAA9999';
> >> printf "%x\n", hex($MAC) - 1;
>
> >> Ben
>
> > What if there are not 4 leading 0s.
> > my $MAC = '000BAAAA9999';
> > printf "%x\n", hex($MAC) - 1;
> > Integer overflow in hexadecimal number
>
> Pragmatic approach: split up into smaller parts, do the math, then
> re-assemble.
>
Good idea. :-)
------------------------------
Date: Tue, 18 Mar 2008 11:21:00 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: FAQ 5.39 Why do I get weird spaces when I print an array of lines?
Message-Id: <86d4ps80lv.fsf@lifelogs.com>
On Mon, 17 Mar 2008 23:08:27 +0100 Michele Dondi <bik.mido@tiscalinet.it> wrote:
MD> On Mon, 17 Mar 2008 09:46:28 -0500, Ted Zlatanov <tzz@lifelogs.com>
MD> wrote:
>> Note also that it doesn't just 'join' the elements but it also prints
>> them, which is obvious but still incorrect in the FAQ.
MD> What is "it"? It's not clear from the context, because print() does
MD> print them, but it's up to the double quotes a.k.a. qq() to join
MD> interpolated arrays.
MD> my $s = "@{[qw/foo bar baz/]}";
MD> print $s;
In the context of the FAQ that I quoted "it" was a single
print "@array";
line. That's why I made the correction s/join/print/. It's pedantic
and really not too important.
Ted
------------------------------
Date: Tue, 18 Mar 2008 04:37:45 -0700 (PDT)
From: "Venkatesh can....can..." <venkatesh.sourav@gmail.com>
Subject: hex to binary
Message-Id: <2259a8e2-a2e1-460f-bb10-9ecc9d7d2c51@e10g2000prf.googlegroups.com>
How to convert hexadecimal number to binary in perl ??
------------------------------
Date: Tue, 18 Mar 2008 13:04:26 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: hex to binary
Message-Id: <frob25$4ic$2@nntp.fujitsu-siemens.com>
Venkatesh can....can... wrote:
> How to convert hexadecimal number to binary in perl ??
perldoc -f hex
--
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Tue, 18 Mar 2008 16:28:51 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: hex to binary
Message-Id: <b7rvt3hsm49e39o32tm27ugj705fntkdoh@4ax.com>
"Venkatesh can....can..." <venkatesh.sourav@gmail.com> wrote:
>How to convert hexadecimal number to binary in perl ??
You must have missed the current discussion titled "decrease MAC".
There are no hexadicimal numbers but only numbers in hexadecimal
representation. And the same for binary.
So, use hex() to convert the string into a number and then sprintf() to
convert the number into a binary representation as string.
jue
------------------------------
Date: Tue, 18 Mar 2008 00:37:26 -0700 (PDT)
From: Koszalek Opalek <koszalekopalek@interia.pl>
Subject: Re: Inside-out objects are slow! (or how to accelerate OO Perl?)
Message-Id: <addbfdb0-e9a6-41c9-98e4-71d559a89511@p73g2000hsd.googlegroups.com>
On Mar 17, 8:44=A0am, Koszalek Opalek <koszalekopa...@interia.pl> wrote:
> However, a simple experiment reveals that the opposite is true.
> Inside-out objects are approximately 3 times slower in this example --
> and it gets worse as the number of object grows.
>
> bash-3.2$ time ./makeregularobj.pl
> real =A0 =A00m0.156s
> user =A0 =A00m0.093s
> sys =A0 =A0 0m0.000s
>
> bash-3.2$ time ./makeinsideoutobj.pl
> real =A0 =A00m0.437s
> user =A0 =A00m0.358s
> sys =A0 =A0 0m0.015s
Wooow, look at this:
bash-3.2$ time perl ./makeregularobj.pl 100000
Created 100000 objects (blessed hashes), data stored in ten fields
inside a hash.
real 0m0.734s
user 0m0.655s
sys 0m0.015s
bash-3.2$ time perl ./makeinsideoutobj.pl 100000
Created 100000 inside-out objects (blessed scalars).
real 0m0.436s
user 0m0.343s
sys 0m0.031s
Wet your appetite. I will send details in the evening.
Until then ;-)
Koszalek
------------------------------
Date: Tue, 18 Mar 2008 11:29:22 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Inside-out objects are slow! (or how to accelerate OO Perl?)
Message-Id: <868x0g807x.fsf@lifelogs.com>
On 17 Mar 2008 21:28:09 GMT xhoster@gmail.com wrote:
x> Ted Zlatanov <tzz@lifelogs.com> wrote:
>> On Mon, 17 Mar 2008 11:18:47 -0700 (PDT) Koszalek Opalek
>> <koszalekopalek@interia.pl> wrote:
>>
KO> Actually, I've been entertaining the idea of rewriting the module in
KO> C/C++ for some time. Chances are it would make it blindingly fast,
KO> but the ease and convenience of Perl (and the ability to hack/extend
KO> it by anyone) is not something I want to give up lightly.
>>
>> Try Inline::C. It's a very good compromise between C and Perl.
x> I'm a fan of Inline::C, but I don't see it being very good for this type of
x> OO, where you have a very large number of very light-weight objects. To
x> get good benefits, you would probably have to push the container of the
x> objects--not just the objects themselves--plus all operations operating on
x> the container, down into C.
It really depends on the application, but generally I agree (except I
didn't recommend Inline::C for OO work, and I wouldn't).
In this case these operations and containers may be small enough (in
terms of lines of code) that Inline::C makes sense. Regardless OO
should probably be avoided in a performance-critical application at the
deeper layers. It's fine at the upper layers, wherever you don't have
to worry about algorithmic complexity, e.g. to handle configuration
management.
Ted
------------------------------
Date: Tue, 18 Mar 2008 05:17:47 -0700 (PDT)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: Installing a perl module manually on windows
Message-Id: <95dd74e2-546a-4cd5-b536-f464af983b0e@e10g2000prf.googlegroups.com>
On Mar 18, 10:34=A0am, "Nospam" <nos...@nospam.com> wrote:
> does anyone know how I might be able to manually install an activeperl
> module
It's basically the same process as for installing modules on any other
OS:
1) Download the module's source from CPAN;
2) Extract the source to some location;
3) cd to the top level source folder;
4) run 'perl Makefile.PL', 'make test' and 'make install' (in that
order).
I use the term 'make' in a generic sense. I recommend that you install
'dmake' (freely available from CPAN) and use that instead of 'make'.
It's just a matter of installing 'dmake' as per the instructions that
ship with it, and then adding the location of 'dmake.exe' to your
path.
For many (most) modules, you'll also need a compiler - I recommend the
freely available MinGW port of gcc. Once installed, add C:\MinGW\bin
to your path (assuming that you installed into C:\MinGW). The dmake/
MinGW combo works fine with ActivePerl.
You could, if you like, save yourself some trouble and install
Strawberry Perl (which ships with both dmake and MinGW - and sets up
your path for you as part of the installation process).
Cygwin, as also suggested, is definitely an option. It, like
Strawberry Perl, also ships with its own make (called 'make') and
('gcc') compiler - but it's an inferior option in my opinion (unless
you particularly want to do unixy things on Windows).
You might find enlightenment at http://www.perlmonks.org/index.pl?node_id=3D=
614808,
but there's also an abundance of other useful information at perlmonks
- take a look through http://www.perlmonks.org/index.pl?node_id=3D519392
=2E
Cheers,
Rob
------------------------------
Date: Tue, 18 Mar 2008 11:22:11 +0100
From: Rodion <hitodenashi@alexandria.cc>
Subject: Problem with loop control LAST exiting prematurely
Message-Id: <MPG.2249b63a15fea9ae9896b0@news.metronet.hr>
Hi!
I got into a problem with looking up stuff in hasheshes, the sub is
supposed to check if $data is in the hash, and when found exit the loop,
as there is no need to go through the rest of the hash.
Only for some reason it exits immediately :?
the code:
--------
CODECHECK: while ( ($k,$v) = each %{$cb{$cbName}}) {
switch ($test){
case 'numbers' {
if ($data==$k){
$found=1;
last CODECHECK if ($found==1);
}
}
case 'text' {
if ($data eq $k){
$found=1;
last CODECHECK if ($found==1);
}
}
}
}
-----------
The problem is that last exits the loop before $found is set which
shouldnt happen.
TIA!
--
Professor: Now, be careful, Fry. And if you kill anyone, make sure
to eat their heart to gain their courage. Their rich tasty courage.
------------------------------
Date: Tue, 18 Mar 2008 10:28:37 +0000 (UTC)
From: Willem <willem@stack.nl>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <slrnftv6al.1lf2.willem@snail.stack.nl>
Rodion wrote:
) Hi!
) I got into a problem with looking up stuff in hasheshes, the sub is
) supposed to check if $data is in the hash, and when found exit the loop,
) as there is no need to go through the rest of the hash.
) Only for some reason it exits immediately :?
)
) the code:
) --------
) CODECHECK: while ( ($k,$v) = each %{$cb{$cbName}}) {
) switch ($test){
) case 'numbers' {
) if ($data==$k){
) $found=1;
) last CODECHECK if ($found==1);
) }
) }
) case 'text' {
) if ($data eq $k){
) $found=1;
) last CODECHECK if ($found==1);
) }
) }
) }
) }
) -----------
) The problem is that last exits the loop before $found is set which
) shouldnt happen.
How do you know that it's the 'last' that is exiting the loop ?
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
------------------------------
Date: Tue, 18 Mar 2008 11:38:35 +0100
From: Rodion <hitodenashi@alexandria.cc>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <MPG.2249ba127c81f5449896b1@news.metronet.hr>
Jednom davno, ne znam vise kad, Willem duboko zamisljen/a rece:
> Rodion wrote:
> ) The problem is that last exits the loop before $found is set which
> ) shouldnt happen.
>
> How do you know that it's the 'last' that is exiting the loop ?
Easily, if I comment it out, it works correctly, albait slowly as it has
to go through the whole hash which is unnaceptable :(
--
Professor: Now, be careful, Fry. And if you kill anyone, make sure
to eat their heart to gain their courage. Their rich tasty courage.
------------------------------
Date: Tue, 18 Mar 2008 11:33:47 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <vMNDj.107108$w57.9930@edtnps90>
Rodion wrote:
> Hi!
> I got into a problem with looking up stuff in hasheshes, the sub is
> supposed to check if $data is in the hash, and when found exit the loop,
> as there is no need to go through the rest of the hash.
> Only for some reason it exits immediately :?
>
> the code:
> --------
> CODECHECK: while ( ($k,$v) = each %{$cb{$cbName}}) {
> switch ($test){
> case 'numbers' {
> if ($data==$k){
> $found=1;
> last CODECHECK if ($found==1);
> }
> }
> case 'text' {
> if ($data eq $k){
> $found=1;
> last CODECHECK if ($found==1);
> }
> }
> }
> }
> -----------
> The problem is that last exits the loop before $found is set which
> shouldnt happen.
Couldn't you just write that as:
$found = 1 if exists $cb{$cbName}{$data};
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Tue, 18 Mar 2008 14:17:55 +0100
From: Rodion <hitodenashi@alexandria.cc>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <MPG.2249df6f79b8ec5d9896b2@news.metronet.hr>
Jednom davno, ne znam vise kad, John W. Krahn duboko zamisljen/a rece:
> Couldn't you just write that as:
>
> $found = 1 if exists $cb{$cbName}{$data};
>
Well I get the same problem, some cases arent found in the hash key...
I think it's a data type problem...confusing...
--
Professor: Now, be careful, Fry. And if you kill anyone, make sure
to eat their heart to gain their courage. Their rich tasty courage.
------------------------------
Date: Tue, 18 Mar 2008 16:02:47 +0100
From: Rodion <hitodenashi@alexandria.cc>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <MPG.2249f801d5a8af8f9896b3@news.metronet.hr>
Jednom davno, ne znam vise kad, John W. Krahn duboko zamisljen/a rece:
>
> Couldn't you just write that as:
>
> $found = 1 if exists $cb{$cbName}{$data};
Well, I have to thank you for putting me on the right track!
There was a problem with some numeric data having prefixed zeroes while
some of the hash keys did not so there could be no match ( 0567 != 567).
But I'm still confused why the LAST was triggered before a match was
$found?
In any case the code is now much leaner :)
I heart Perl!
--
Professor: Now, be careful, Fry. And if you kill anyone, make sure
to eat their heart to gain their courage. Their rich tasty courage.
------------------------------
Date: 18 Mar 2008 15:28:57 GMT
From: xhoster@gmail.com
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <20080318112859.173$0P@newsreader.com>
Rodion <hitodenashi@alexandria.cc> wrote:
> Jednom davno, ne znam vise kad, John W. Krahn duboko zamisljen/a rece:
>
> >
> > Couldn't you just write that as:
> >
> > $found = 1 if exists $cb{$cbName}{$data};
>
> Well, I have to thank you for putting me on the right track!
>
> There was a problem with some numeric data having prefixed zeroes while
> some of the hash keys did not so there could be no match ( 0567 != 567).
> But I'm still confused why the LAST was triggered before a match was
> $found?
I rather doubt that it was doing that. If you want to pursue the matter,
post a complete, runnable script to illustrate this. Otherwise I'll assume
you are misinterpreting something.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Tue, 18 Mar 2008 16:40:57 +0100
From: Rodion <hitodenashi@alexandria.cc>
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <MPG.224a00f8c51e046f9896b4@news.metronet.hr>
Jednom davno, ne znam vise kad, xhoster@gmail.com duboko zamisljen/a
rece:
> Rodion <hitodenashi@alexandria.cc> wrote:
> > Jednom davno, ne znam vise kad, John W. Krahn duboko zamisljen/a rece:
> >
> > >
> > > Couldn't you just write that as:
> > >
> > > $found = 1 if exists $cb{$cbName}{$data};
> >
> > Well, I have to thank you for putting me on the right track!
> >
> > There was a problem with some numeric data having prefixed zeroes while
> > some of the hash keys did not so there could be no match ( 0567 != 567).
> > But I'm still confused why the LAST was triggered before a match was
> > $found?
>
> I rather doubt that it was doing that. If you want to pursue the matter,
> post a complete, runnable script to illustrate this. Otherwise I'll assume
> you are misinterpreting something.
Well, I'm most certanly misundrestanding something, but I'd like to know
what, so I don't make the same mistake twice :/
The following subrutine works correctly (and slowly) if the lines with
LAST are commented out.
Code:
sub checkCB{
my $cbName=$_[0];
my $data=$_[1];
my ($k,$v);
my $found;
my $g=0;
my $checked;
my $test='text';
print "looking for [$data] in [$cbName] control: ";
#----numbers exception
if ($data=~/^\d{1,30}$/){
$data=int($data);
$test='numbers';
}
CODECHECK: while ( ($k,$v) = each %{$cb{$cbName}}) {
#print $g++."\n";
switch ($test){
case 'numbers' {
if ($data==$k){
$found=1;
#last CODECHECK if ($found==1);
}
}
case 'text' {
if ($data eq $k){
$found=1;
#last CODECHECK if ($found==1);
}
}
}
}
return $found;
}
---------
--
Professor: Now, be careful, Fry. And if you kill anyone, make sure
to eat their heart to gain their courage. Their rich tasty courage.
------------------------------
Date: 18 Mar 2008 16:16:58 GMT
From: xhoster@gmail.com
Subject: Re: Problem with loop control LAST exiting prematurely
Message-Id: <20080318121659.739$QN@newsreader.com>
Rodion <hitodenashi@alexandria.cc> wrote:
> Jednom davno, ne znam vise kad, xhoster@gmail.com duboko zamisljen/a
> rece:
>
> > Rodion <hitodenashi@alexandria.cc> wrote:
> > > Jednom davno, ne znam vise kad, John W. Krahn duboko zamisljen/a
> > > rece:
> > >
> > > >
> > > > Couldn't you just write that as:
> > > >
> > > > $found = 1 if exists $cb{$cbName}{$data};
> > >
> > > Well, I have to thank you for putting me on the right track!
> > >
> > > There was a problem with some numeric data having prefixed zeroes
> > > while some of the hash keys did not so there could be no match ( 0567
> > > != 567). But I'm still confused why the LAST was triggered before a
> > > match was $found?
> >
> > I rather doubt that it was doing that. If you want to pursue the
> > matter, post a complete, runnable script to illustrate this. Otherwise
> > I'll assume you are misinterpreting something.
>
> Well, I'm most certanly misundrestanding something, but I'd like to know
> what, so I don't make the same mistake twice :/
>
> The following subrutine works correctly (and slowly) if the lines with
> LAST are commented out.
Global symbol "%cb" requires explicit package name...
And if I make up my own values for %cb, then I don't see what you
say you see.
Please post COMPLETE, RUNNABLE code which illustrates that which is to
be illustrated.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Tue, 18 Mar 2008 10:52:55 -0700 (PDT)
From: ptilderegex <ptilderegex@gmail.com>
Subject: Re: P~(ptilde) 0.9 released, new scripting language with novel regex
Message-Id: <bf1ef3a5-0c92-4fd1-94ad-15b43279ef47@m3g2000hsc.googlegroups.com>
> > The point ofPtildeis that you can do these complex stream
> > transformations of any kind at all in one regex pass. =A0What you've got=
> > above is a while loop, not a single regex pass.
>
> You say that as if it's a bad thing.
>
Not that the Perl solution given above is a bad thing, but we're just
saying that certain complex transformations can be done in P~ in a
single-pass regex, which can turn on/off or redirect transformation
output, or insert output at any nesting level of a subcomposition,
which is a feature that seems to add value to P~ relative to other NFA
regex engines that lack the equivalent of the Ptilde do-pattern.
------------------------------
Date: Tue, 18 Mar 2008 01:40:34 -0700 (PDT)
From: himanshu.garg@gmail.com
Subject: Source for the open perl function
Message-Id: <f81f44ce-b1d4-4582-86ac-a8a4cf083f83@i29g2000prf.googlegroups.com>
Hello,
Could you tell me which file in the perl sources has the source
code for the perl open function, please.
Thank You,
Himanshu
------------------------------
Date: Tue, 18 Mar 2008 16:12:49 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Source for the open perl function
Message-Id: <1965b5-0b2.ln1@osiris.mauzo.dyndns.org>
Quoth himanshu.garg@gmail.com:
>
> Could you tell me which file in the perl sources has the source
> code for the perl open function, please.
In 5.8 and 5.10, the actual open function is pp_open in pp_sys.c, but
the bulk of the work is done by Perl_do_openn in doio.c. Note that
understanding either of these functions will require a working knowledge
of the perl5 internals: the perl source makes heavy use of macros, which
often do things you weren't entirely expecting.
Ben
------------------------------
Date: Tue, 18 Mar 2008 04:09:52 -0700 (PDT)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: why is return always 0?
Message-Id: <8965dd04-3c9d-4959-923d-2cb25eb03550@i12g2000prf.googlegroups.com>
On Mar 16, 5:45 pm, jammer <jamesloc...@mail.com> wrote:
> How do I make tftp fail if the host is bad?
>
> my $rc = system( "/usr/bin/tftp bad$host < $tempFile 2>&1 >/
> dev/null" );
> if ( $rc != 0 ) {
> print "unable to tftp to '$host'\n";
> exit 1;
> } else {
> print "success: $rc\n";
> }
On Solaris anyway, tftp doesn't return an exit code - just writes to
stdout and then prompts.
So you'd have to short-circuit its prompt and
parse the output for specific errors, eg.:
$out = qx { /usr/bin/tftp badhost </dev/null };
if ( $? ) {
die "can't start tftp: $?";
} elsif ($out =~ /unknown host/ ) {
die "failed: $out";
} else {
# ok
...
}
hth,
--
Charles DeRykus
------------------------------
Date: Tue, 18 Mar 2008 08:12:45 -0500
From: hymie_@_lactose.homelinux.net (hymie!)
Subject: Re: why is return always 0?
Message-Id: <ecadnZegh51QIkLanZ2dnUVZ_hynnZ2d@comcast.com>
In our last episode, the evil Dr. Lacto had captured our hero,
sandy_saydakov@yahoo.com, who said:
>On Mar 17, 12:56 pm, jammer <jamesloc...@mail.com> wrote:
>> > Make sure the binary returns non-zero on failure. Try that command on
>> > the command line and do "echo $?" right after.
>>
>> tftp does run, it just can't find the host.
>> It returns 0 because it ran, didn't work but it ran. :-(
>
>So there must be a bug in tftp then. It makes no sense to have a clean
>exit code on failure.
The fact that the host does not exist does not necessarily mean that
the tftp program failed, thus the 0 exit code.
eric-x% nslookup fuzzy
Server: 205.196.81.2
Address: 205.196.81.2#53
** server can't find fuzzy: NXDOMAIN
eric-x% echo $?
0
eric-x% finger hymie
finger: hymie: no such user.
eric-x% echo $?
0
eric-x%
--hymie! http://lactose.homelinux.net/~hymie hymie@lactose.homelinux.net
------------------------ Without caffeine for 504 days ------------------------
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 1371
***************************************