[30008] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1251 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 2 00:09:43 2008

Date: Fri, 1 Feb 2008 21:09:09 -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           Fri, 1 Feb 2008     Volume: 11 Number: 1251

Today's topics:
        Different behavior between eval "07" and eval "08" <netcasper@gmail.com>
    Re: Different behavior between eval "07" and eval "08" <someone@example.com>
    Re: Different behavior between eval "07" and eval "08" <jurgenex@hotmail.com>
    Re: Different behavior between eval "07" and eval "08" <netcasper@gmail.com>
        Perl on Linux and AIX dcruncher4@aim.com
    Re: Perl on Linux and AIX <niel@devnull.org>
    Re: Perl on Linux and AIX <uri@stemsystems.com>
    Re: Perl on Linux and AIX <ignoramus31882@NOSPAM.31882.invalid>
    Re: Perl on Linux and AIX dcruncher4@aim.com
    Re: Perl on Linux and AIX dcruncher4@aim.com
    Re: Perl on Linux and AIX <spamtrap42@verizon.net>
    Re: Perl on Linux and AIX <mikea@mikea.ath.cx>
    Re: Perl on Linux and AIX <uri@stemsystems.com>
    Re: Perl on Linux and AIX <uri@stemsystems.com>
    Re: Perl on Linux and AIX <uri@stemsystems.com>
    Re: Perl regular expressions <stoupa@practisoft.cz>
    Re: Perl regular expressions <tadmc@seesig.invalid>
    Re: Perl regular expressions <allab@sympatico.ca>
    Re: Perl regular expressions <allab@sympatico.ca>
    Re: Perl regular expressions <uri@stemsystems.com>
        regx expression? (link included) <drubnone@yahoo.com>
    Re: regx expression? (link included) <ben@morrow.me.uk>
    Re: regx expression? (link included) <usenet@davidfilmer.com>
    Re: Trying to properly use WWW::Mechanize <phillip.s.powell@gmail.com>
    Re: Trying to properly use WWW::Mechanize <joost@zeekat.nl>
    Re: Trying to properly use WWW::Mechanize <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 1 Feb 2008 18:59:51 -0800 (PST)
From: Liang Wang <netcasper@gmail.com>
Subject: Different behavior between eval "07" and eval "08"
Message-Id: <eda9ef6d-706a-45a0-afa4-b556f1312db5@v67g2000hse.googlegroups.com>

eval "07" gets 7 but eval "08" gets an undefined value.  I tested perl
5.8.8 on fedora 8 and ubuntu.

Is there any difference between those two eval statements?  Is this a
bug?



------------------------------

Date: Sat, 02 Feb 2008 03:19:05 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Different behavior between eval "07" and eval "08"
Message-Id: <JiRoj.4969$w57.2140@edtnps90>

Liang Wang wrote:
> eval "07" gets 7 but eval "08" gets an undefined value.  I tested perl
> 5.8.8 on fedora 8 and ubuntu.
> 
> Is there any difference between those two eval statements?  Is this a
> bug?

No, there is no difference in the eval statements.  The problem is that 
"08" is not a valid octal number.


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: Sat, 02 Feb 2008 03:25:12 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Different behavior between eval "07" and eval "08"
Message-Id: <2ho7q395olt981b31edjik553b349i4pf6@4ax.com>

Liang Wang <netcasper@gmail.com> wrote:
>eval "07" gets 7 but eval "08" gets an undefined value.  I tested perl
>5.8.8 on fedora 8 and ubuntu.
>
>Is there any difference between those two eval statements? 

Yes. The digit 7 is a valid octal digit, 8 is not a valid octal digit.

jue


------------------------------

Date: Fri, 1 Feb 2008 19:27:34 -0800 (PST)
From: Liang Wang <netcasper@gmail.com>
Subject: Re: Different behavior between eval "07" and eval "08"
Message-Id: <72222e9a-9999-4fa0-b56f-ed42eedfb151@i7g2000prf.googlegroups.com>

On Feb 2, 11:19 am, "John W. Krahn" <some...@example.com> wrote:
> Liang Wang wrote:
> > eval "07" gets 7 but eval "08" gets an undefined value.  I tested perl
> > 5.8.8 on fedora 8 and ubuntu.
>
> > Is there any difference between those two eval statements?  Is this a
> > bug?
>
> No, there is no difference in the eval statements.  The problem is that
> "08" is not a valid octal number.
>
> 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

Got it.  Thanks.

I've tested "06", but not "09".  What I really want to do is to
transform string "08" to integer 8.  But in this case, eval doesn't
treat "08" as string, as you said.


------------------------------

Date: 1 Feb 2008 15:28:29 -0800
From: dcruncher4@aim.com
Subject: Perl on Linux and AIX
Message-Id: <fo09ut02e3f@drn.newsguy.com>

perl -v

This is perl, v5.8.0 built for i386-linux-thread-multi

here is a simple program (script name test.pl)

#! /usr/bin/perl -w

open(MSGF,"/dev/stdin") or die "ERROR\n" ;
while ( <MSGF> ) {
   print $_ ;
}
close(MSGF);

I want to call it either of the two ways

test.pl < a_file
cat a_file | test.pl

On Solaris 5.10 both method works fine.

On Linux is 2.4.21-52.ELsmp #1 SMP i686 i686 i386 GNU/Linux

It works the first method. 

But the second method fails. It dies with "ERROR".

On AIX 3 5 00CFADDC4C00 both methods are failing.


What can be the reason? I am a perl programmer and I don't know
much about Linux or AIX internals.

Is there a better way to do the task in Perl or do I have to write 
OS specific code (I am open to that).

Thanks.



------------------------------

Date: Sat, 02 Feb 2008 02:10:01 +0200
From: Niel Lambrechts <niel@devnull.org>
Subject: Re: Perl on Linux and AIX
Message-Id: <fo0cc5$pid$1@aioe.org>

dcruncher4@aim.com wrote:
> perl -v
> 
> This is perl, v5.8.0 built for i386-linux-thread-multi
> 
> here is a simple program (script name test.pl)
> 
> #! /usr/bin/perl -w
> 
> open(MSGF,"/dev/stdin") or die "ERROR\n" ;

I think you did it in a non-portable way.

# no need to call open()
while (<STDIN>) {
 ...
}

# or duplicate the FD
open(INCOPY,  "<&STDIN" )   or die "Couldn't dup STDIN : $!";

# or alias the FD
open(INALIAS,  "<&=STDIN")  or die "Couldn't alias STDIN : $!";

cheers
Niel


------------------------------

Date: Sat, 02 Feb 2008 00:11:37 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl on Linux and AIX
Message-Id: <x74pcsnrnw.fsf@mail.sysarch.com>

>>>>> "d" == dcruncher4  <dcruncher4@aim.com> writes:

  d> open(MSGF,"/dev/stdin") or die "ERROR\n" ;

why are you explicitly opening that? stdin is already opened for your
program. that is your problem. that device is probably OS specific and
it has nothing to do with perl.

just use <> and it will read from your stdin just fine.

  d> while ( <MSGF> ) {

	while ( <> ) {

  d> I want to call it either of the two ways

  d> test.pl < a_file
  d> cat a_file | test.pl

useless use of cat award.

  d> On Solaris 5.10 both method works fine.
  d> On Linux is 2.4.21-52.ELsmp #1 SMP i686 i686 i386 GNU/Linux
  d> It works the first method. 
  d> But the second method fails. It dies with "ERROR".
  d> On AIX 3 5 00CFADDC4C00 both methods are failing.

see if you even have /dev/stdin on those boxes. as i said, it makes no
sense to open it with that special device.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Fri, 01 Feb 2008 20:13:19 -0600
From: Ignoramus31882 <ignoramus31882@NOSPAM.31882.invalid>
Subject: Re: Perl on Linux and AIX
Message-Id: <JJadnRnGgM4iTD7anZ2dnUVZ_qbinZ2d@giganews.com>

On 2008-02-01, dcruncher4@aim.com <dcruncher4@aim.com> wrote:
> perl -v
>
> This is perl, v5.8.0 built for i386-linux-thread-multi
>
> here is a simple program (script name test.pl)
>
> #! /usr/bin/perl -w
>
> open(MSGF,"/dev/stdin") or die "ERROR\n" ;
> while ( <MSGF> ) {
>    print $_ ;
> }
> close(MSGF);

Try 

while( <STDIN> ) {
       ...
}

you are doing it in a very  wrong way.

> I want to call it either of the two ways
>
> test.pl < a_file
> cat a_file | test.pl
>
> On Solaris 5.10 both method works fine.
>
> On Linux is 2.4.21-52.ELsmp #1 SMP i686 i686 i386 GNU/Linux
>
> It works the first method. 
>
> But the second method fails. It dies with "ERROR".
>
> On AIX 3 5 00CFADDC4C00 both methods are failing.
>
>
> What can be the reason? I am a perl programmer and I don't know
> much about Linux or AIX internals.
>
> Is there a better way to do the task in Perl or do I have to write 
> OS specific code (I am open to that).
>
> Thanks.
>


------------------------------

Date: 1 Feb 2008 18:17:15 -0800
From: dcruncher4@aim.com
Subject: Re: Perl on Linux and AIX
Message-Id: <fo0jrb0vj@drn.newsguy.com>

In article <fo0cc5$pid$1@aioe.org>, Niel Lambrechts says...

>I think you did it in a non-portable way.
>
># no need to call open()
>while (<STDIN>) {
>...
>}

You are right. What was I thinking. Actually this is a rewrite from
C to perl and I should used the C logic. 

thanks.



------------------------------

Date: 1 Feb 2008 18:18:31 -0800
From: dcruncher4@aim.com
Subject: Re: Perl on Linux and AIX
Message-Id: <fo0jtn014h@drn.newsguy.com>

In article <x74pcsnrnw.fsf@mail.sysarch.com>, Uri Guttman says...

>
>  d> test.pl < a_file
>  d> cat a_file | test.pl
>
>useless use of cat award.

ha ha.

Can't help it. This script will be called by other scripts and
my script has to be backward compatible with the C one.



------------------------------

Date: Sat, 02 Feb 2008 02:50:11 GMT
From: "Robert M. Riches Jr." <spamtrap42@verizon.net>
Subject: Re: Perl on Linux and AIX
Message-Id: <slrnfq7mj4.84f.rob@one.localnet>

On 2008-02-02, dcruncher4@aim.com <dcruncher4@aim.com> wrote:
> In article <x74pcsnrnw.fsf@mail.sysarch.com>, Uri Guttman says...
>
>>
>>  d> test.pl < a_file
>>  d> cat a_file | test.pl
>>
>>useless use of cat award.
>
> ha ha.
>
> Can't help it. This script will be called by other scripts and
> my script has to be backward compatible with the C one.

What is wrong with

        test.pl < a_file

???

-- 
Robert Riches
spamtrap42@verizon.net
(Yes, that is one of my email addresses.)


------------------------------

Date: Sat, 2 Feb 2008 02:59:27 +0000 (UTC)
From: "Mike Andrews" <mikea@mikea.ath.cx>
Subject: Re: Perl on Linux and AIX
Message-Id: <fo0maf$cod$2@puck.litech.org>

In comp.unix.aix,
 Robert M. Riches Jr. <spamtrap42@verizon.net> wrote:

> On 2008-02-02, dcruncher4@aim.com <dcruncher4@aim.com> wrote:
>> In article <x74pcsnrnw.fsf@mail.sysarch.com>, Uri Guttman says...
>>
>>>
>>>  d> test.pl < a_file
>>>  d> cat a_file | test.pl
>>>
>>>useless use of cat award.
>>
>> ha ha.
>>
>> Can't help it. This script will be called by other scripts and
>> my script has to be backward compatible with the C one.

> What is wrong with

>        test.pl < a_file

<delurk>

If I'm writing scripts to read from stdin, I like to test them using
the same format that will be used in production. 

I.e., if script PL is going to see output from program C, as in
	C | PL > foo 
then I include 
something feeding PL through a pipe, e.g., 
	cat C_output | PL
in the test harness
just so others can see how PL is to be run.

It's not a _useless_ use of cat, because the shape of the line shows
the neophyte who takes over when I'm sick or get hit by a truck just 
how PL is used. There's a visual difference between 
	PL < C_output 
and 
	cat C_output | PL
since 
	cat C_output 
looks more like
	C | PL > foo
than does
	PL < C_output
 .

IMHO, anyway. 

</delurk>

-- 
I trust the cut&paste under Win2k's telnet about as far as I can comfortably 
spit a rat.
                        -- John Burnham, in the Monastery


------------------------------

Date: Sat, 02 Feb 2008 03:31:43 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl on Linux and AIX
Message-Id: <x7y7a4kp9h.fsf@mail.sysarch.com>

>>>>> "d" == dcruncher4  <dcruncher4@aim.com> writes:

  d> In article <x74pcsnrnw.fsf@mail.sysarch.com>, Uri Guttman says...
  >> 
  d> test.pl < a_file
  d> cat a_file | test.pl
  >> 
  >> useless use of cat award.

  d> ha ha.

  d> Can't help it. This script will be called by other scripts and
  d> my script has to be backward compatible with the C one.

huh?? that makes absolutely no sense. those two lines do the exact same
thing from the point of view of the perl script or any program in any
language that reads from stdin. you don't seem to have a grasp of how
stdio and redirection works on unix flavors.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Sat, 02 Feb 2008 03:33:12 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl on Linux and AIX
Message-Id: <x7tzkskp6y.fsf@mail.sysarch.com>

>>>>> "MA" == Mike Andrews <mikea@mikea.ath.cx> writes:

  MA> It's not a _useless_ use of cat, because the shape of the line shows
  MA> the neophyte who takes over when I'm sick or get hit by a truck just 
  MA> how PL is used. There's a visual difference between 
  MA> 	PL < C_output 
  MA> and 
  MA> 	cat C_output | PL
  MA> since 
  MA> 	cat C_output 
  MA> looks more like
  MA> 	C | PL > foo
  MA> than does
  MA> 	PL < C_output
  MA> .

  MA> IMHO, anyway. 

useless use of a herd of cats award!

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Sat, 02 Feb 2008 03:36:14 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl on Linux and AIX
Message-Id: <x7prvgkp1v.fsf@mail.sysarch.com>

>>>>> "d" == dcruncher4  <dcruncher4@aim.com> writes:

  d> In article <fo0cc5$pid$1@aioe.org>, Niel Lambrechts says...
  >> I think you did it in a non-portable way.
  >> 
  >> # no need to call open()
  >> while (<STDIN>) {
  >> ...
  >> }

  d> You are right. What was I thinking. Actually this is a rewrite from
  d> C to perl and I should used the C logic. 

what does C logic have to do with opening an OS specific device like
/dev/stdin? all programs in all languages on unix flavors have stdin
open if forked from the shell (i will ignore those case where stdin is
closed by the parent). even in c you wouldn't need to open /dev/stdin
and if you did it should fail the same way on the same platforms as your
perl code. my point is again, it isn't a perl issue but a special device
on your platform issue and your not using the normal stdio given to you.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Sat, 2 Feb 2008 02:31:28 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Perl regular expressions
Message-Id: <fo0h7j$2gh4$2@ns.felk.cvut.cz>

Martijn Lievaart wrote:
> On Fri, 01 Feb 2008 13:58:10 -0800, Alona wrote:
> 
>> Hello All,
>> 
>> We need to extract from a text a 3-digit numbers surrounded by
>> certain text. For example, we need to extract 199 surrounded by
>> "MESSAGE TYPE" and "SYSTEM/INPUT":
>> 
>> MESSAGE TYPE 199 SYSTEM/INPUT
>> 
>> What would be Perl regular expression for this?
> 
> If you read perldoc perlre you would quickly see that this would be
> 
> /MESSAGE TYPE (\d+) SYSTEM\/INPUT/
> 
Maybe will be safer this

if($row =~ m/MESSAGE\s+TYPE\s+(\d{3})\s+SYSTEM\/INPUT/) 
    {
    my $number = $1; 
    # any other commands
    }

-- 
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.) 

Please reply to <petr AT practisoft DOT cz>



------------------------------

Date: Sat, 02 Feb 2008 02:09:13 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Perl regular expressions
Message-Id: <slrnfq7ihp.fcv.tadmc@tadmc30.sbcglobal.net>

Alona <allab@sympatico.ca> wrote:


> We need to extract from a text a 3-digit numbers surrounded by certain
> text. For example, we need to extract 199 surrounded by "MESSAGE TYPE"
> and "SYSTEM/INPUT":
>
> MESSAGE TYPE 199 SYSTEM/INPUT


   my $num = substr( $_, index($_, 'SYSTEM/INPUT')-4, 3);


> What would be Perl regular expression for this?


Look Ma! No regular expression at all!

:-)


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Fri, 1 Feb 2008 19:08:59 -0800 (PST)
From: Alona <allab@sympatico.ca>
Subject: Re: Perl regular expressions
Message-Id: <c8693c2e-59e1-4053-b25a-333ef6efa46b@j20g2000hsi.googlegroups.com>

On Feb 1, 9:09=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
> Alona <al...@sympatico.ca> wrote:
> > We need to extract from a text a 3-digit numbers surrounded by certain
> > text. For example, we need to extract 199 surrounded by "MESSAGE TYPE"
> > and "SYSTEM/INPUT":
>
> > MESSAGE TYPE 199 SYSTEM/INPUT
>
> =A0 =A0my $num =3D substr( $_, index($_, 'SYSTEM/INPUT')-4, 3);
>
> > What would be Perl regular expression for this?
>
> Look Ma! No regular expression at all!
>
> :-)
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"



Thank you all. Please notice that we are searching for 199 in a
certain context. We are not interested in finding "MESSAGE TYPE" and
"SYSTEM/INPUT". We are only interested in 199, but the match should
only pick 199's surrounded in the text by MESSAGE TYPE adn SYSTEM/
INPUT.

Thanks,
Alona


------------------------------

Date: Fri, 1 Feb 2008 19:13:39 -0800 (PST)
From: Alona <allab@sympatico.ca>
Subject: Re: Perl regular expressions
Message-Id: <3b0cc7b7-ff23-4263-96c2-9d789e71ad5a@s8g2000prg.googlegroups.com>

On Feb 1, 10:08=A0pm, Alona <al...@sympatico.ca> wrote:
> On Feb 1, 9:09=A0pm, Tad J McClellan <ta...@seesig.invalid> wrote:
>
>
>
>
>
> > Alona <al...@sympatico.ca> wrote:
> > > We need to extract from a text a 3-digit numbers surrounded by certain=

> > > text. For example, we need to extract 199 surrounded by "MESSAGE TYPE"=

> > > and "SYSTEM/INPUT":
>
> > > MESSAGE TYPE 199 SYSTEM/INPUT
>
> > =A0 =A0my $num =3D substr( $_, index($_, 'SYSTEM/INPUT')-4, 3);
>
> > > What would be Perl regular expression for this?
>
> > Look Ma! No regular expression at all!
>
> > :-)
>
> > --
> > Tad McClellan
> > email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
>
> Thank you all. Please notice that we are searching for 199 in a
> certain context. We are not interested in finding "MESSAGE TYPE" and
> "SYSTEM/INPUT". We are only interested in 199, but the match should
> only pick 199's surrounded in the text by MESSAGE TYPE adn SYSTEM/
> INPUT.
>
> Thanks,
> Alona- Hide quoted text -
>
> - Show quoted text -

Also, we are not interested in Perl per se, but in perl regular
expression rules :-)


------------------------------

Date: Sat, 02 Feb 2008 04:41:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl regular expressions
Message-Id: <x7fxwckm1o.fsf@mail.sysarch.com>

>>>>> "A" == Alona  <allab@sympatico.ca> writes:

  A> On Feb 1, 10:08 pm, Alona <al...@sympatico.ca> wrote:
  >> On Feb 1, 9:09 pm, Tad J McClellan <ta...@seesig.invalid> wrote:
  >> 
  >> 
  >> 
  >> 
  >> 
  >> > Alona <al...@sympatico.ca> wrote:
  >> > > We need to extract from a text a 3-digit numbers surrounded by certain
  >> > > text. For example, we need to extract 199 surrounded by "MESSAGE TYPE"
  >> > > and "SYSTEM/INPUT":
  >> 
  >> > > MESSAGE TYPE 199 SYSTEM/INPUT
  >> 
  >> >    my $num = substr( $_, index($_, 'SYSTEM/INPUT')-4, 3);
  >> 
  >> > > What would be Perl regular expression for this?
  >> 
  >> > Look Ma! No regular expression at all!
  >> 
  >> > :-)
  >> 
  >> > --
  >> > Tad McClellan
  >> > email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
  >> 
  >> Thank you all. Please notice that we are searching for 199 in a
  >> certain context. We are not interested in finding "MESSAGE TYPE" and
  >> "SYSTEM/INPUT". We are only interested in 199, but the match should
  >> only pick 199's surrounded in the text by MESSAGE TYPE adn SYSTEM/
  >> INPUT.
  >> 
  >> Thanks,
  >> Alona- Hide quoted text -
  >> 
  >> - Show quoted text -

  A> Also, we are not interested in Perl per se, but in perl regular
  A> expression rules :-)

then ask elsewhere as this newsgroup is about perl. note that most perl
compatible regular expressions engines aren't perl nor compatible.

:-(

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Fri, 1 Feb 2008 17:11:49 -0800 (PST)
From: werwer <drubnone@yahoo.com>
Subject: regx expression? (link included)
Message-Id: <5bb63bff-c181-4969-af42-2044da643820@d21g2000prf.googlegroups.com>

A favor please .  Would someone tell me if this regx requires
something I don't have installed?  I copied it, but it will not
compile.  I've never seen a regx written like this and I kind of
wonder if this is input to some other parser.  Thanks.   (perk 5,8,8)

Here's the link. (I pasted a copy below also, but I'm never sure if
it's readable or not)

http://www.perlmonks.org/?node_id=603809


my $email_address = qr {
    (?(DEFINE)
      (?<addr_spec>       (?&local_part) \@ (?&domain))
      (?<local_part>      (?&dot_atom) | (?&quoted_string))
      (?<domain>          (?&dot_atom) | (?&domain_literal))
      (?<domain_literal>  (?&CFWS)? \[ (?: (?&FWS)? (?&dcontent))* (?
&FWS)?
                                    \] (?&CFWS)?)
      (?<dcontent>        (?&dtext) | (?&quoted_pair))
      (?<dtext>           (?&NO_WS_CTL) | [\x21-\x5a\x5e-\x7e])

      (?<atext>           (?&ALPHA) | (?&DIGIT) | [!#\$%&'*+-/=?
^_`{|}~])
      (?<atom>            (?&CFWS)? (?&atext)+ (?&CFWS)?)
      (?<dot_atom>        (?&CFWS)? (?&dot_atom_text) (?&CFWS)?)
      (?<dot_atom_text>   (?&atext)+ (?: \. (?&atext)+)*)

      (?<text>            [\x01-\x09\x0b\x0c\x0e-\x7f])
      (?<quoted_pair>     \\ (?&text))

      (?<qtext>           (?&NO_WS_CTL) | [\x21\x23-\x5b\x5d-\x7e])
      (?<qcontent>        (?&qtext) | (?&quoted_pair))
      (?<quoted_string>   (?&CFWS)? (?&DQUOTE) (?:(?&FWS)? (?
&qcontent))*
                           (?&FWS)? (?&DQUOTE) (?&CFWS)?)

      (?<word>            (?&atom) | (?&quoted_string))
      (?<phrase>          (?&word)+)

      # Folding white space
      (?<FWS>             (?: (?&WSP)* (?&CRLF))? (?&WSP)+)
      (?<ctext>           (?&NO_WS_CTL) | [\x21-\x27\x2a-\x5b\x5d-
\x7e])
      (?<ccontent>        (?&ctext) | (?&quoted_pair) | (?&comment))
      (?<comment>         \( (?: (?&FWS)? (?&ccontent))* (?&FWS)? \) )
      (?<CFWS>            (?: (?&FWS)? (?&comment))*
                          (?: (?:(?&FWS)? (?&comment)) | (?&FWS)))

      # No whitespace control
      (?<NO_WS_CTL>       [\x01-\x08\x0b\x0c\x0e-\x1f\x7f])

      (?<ALPHA>           [A-Za-z])
      (?<DIGIT>           [0-9])
      (?<CRLF>            \x0d \x0a)
      (?<DQUOTE>          ")
      (?<WSP>             [\x20\x09])
    )

    (?&addr_spec)
}x;


------------------------------

Date: Sat, 2 Feb 2008 01:35:44 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: regx expression? (link included)
Message-Id: <g0uc75-j8c1.ln1@osiris.mauzo.dyndns.org>


Quoth werwer <drubnone@yahoo.com>:
> A favor please .  Would someone tell me if this regx requires
> something I don't have installed?  I copied it, but it will not
> compile.  I've never seen a regx written like this and I kind of
> wonder if this is input to some other parser.  Thanks.   (perk 5,8,8)
<snip>
> my $email_address = qr {
>     (?(DEFINE)
>       (?<addr_spec>       (?&local_part) \@ (?&domain))

Kind-of: this regex is pretty much a demonstration of the new features
in the 5.10 regex engine. So, you would need perl 5.10.0 or later to use
it.

Ben



------------------------------

Date: Fri, 01 Feb 2008 20:15:24 -0800
From: David Filmer <usenet@davidfilmer.com>
Subject: Re: regx expression? (link included)
Message-Id: <ebadnV7lG7KBcz7aRVn_vwA@giganews.com>

Ben Morrow wrote:
> So, you would need perl 5.10.0 or later to use

Of course, Regexp::Common will work fine on the OP's platform: 
http://search.cpan.org/~cwest/Regexp-Common-Email-Address-1.01/lib/Regexp/Common/Email/Address.pm


------------------------------

Date: Fri, 1 Feb 2008 15:33:04 -0800 (PST)
From: Phil Powell <phillip.s.powell@gmail.com>
Subject: Re: Trying to properly use WWW::Mechanize
Message-Id: <b258f8a8-4a41-47cf-b6e7-e962639a7e56@s12g2000prg.googlegroups.com>

On Feb 1, 5:55=A0pm, Phil Powell <phillip.s.pow...@gmail.com> wrote:
> On Feb 1, 5:12=A0pm, Phil Powell <phillip.s.pow...@gmail.com> wrote:
>
>
>
>
>
> > On Feb 1, 5:01=A0pm, Joost Diepenmaat <jo...@zeekat.nl> wrote:
>
> > > Phil Powell <phillip.s.pow...@gmail.com> writes:
> > > > On Feb 1, 4:21=A0pm, Joost Diepenmaat <jo...@zeekat.nl> wrote:
> > > >> Phil Powell <phillip.s.pow...@gmail.com> writes:
> > > >> > On Feb 1, 4:11=A0pm, Joost Diepenmaat <jo...@zeekat.nl> wrote:
> > > >> >> Phil Powell <phillip.s.pow...@gmail.com> writes:
> > > >> >> >> Strawberry perl *should* provide all the means you need to in=
stall cpan
> > > >> >> >> tarballs. Download the thing from CPAN yourself and then do t=
he usual
> > > >> >> >> stuff.
>
> > > >> >> >>http://www.cpan.org/modules/INSTALL.html
>
> > > >> >> > Upon doing so, I am prompted (via the instructions to run Make=
file.PL)
> > > >> >> > to provide the directory where the SSL Headers are located, us=
ing as
> > > >> >> > default "C:\openssl". =A0Where would I find the appropriate SS=
L Headers
> > > >> >> > in order to accomplish this?
>
> > > >> >> See:http://search.cpan.org/src/DLAND/Crypt-SSLeay-0.57/README
>
> > > >> >> Specifically:
>
> > > >> >> =A0 =A0"You must have OpenSSL or SSLeay installed before compili=
ng this module.
> > > >> >> =A0 =A0 You can get the latest OpenSSL package from:
>
> > > >> >> =A0 =A0 =A0http://www.openssl.org"
>
> > > >> > Can you point me to a stable version of OpenSSL to use? Went to t=
he
> > > >> > site and attempted to download openssl-0.9.6.tar.gz only to get a=

> > > >> > corrupted .tar.tar file instead every time.
>
> > > >> Get a decent browser or rename it back to tar.gz / rename it to .ta=
r. I
> > > >> forget which is the correct solution. MSIE fucks with .gz extension=
s.
>
> > > >> Also, google for "openssl windows" would have found:http://www.open=
ssl.org/related/binaries.html
> > > >> which points tohttp://www.slproweb.com/products/Win32OpenSSL.html
>
> > > >> You will probably wanthttp://www.slproweb.com/download/Win32OpenSSL=
-0_9_8g.exe
>
> > > >> =A0"Note that this is a default build of OpenSSL and is
> > > >> =A0 subject to local and state laws. More information can
> > > >> =A0 be found in the legal agreement of the installation."
>
> > > > Thanks the Win32OpenSSL exe auto-install worked inasmuch as I seem t=
o
> > > > be able to get a little farther with attempting to install
> > > > Crypt::SSLeay; I now get the following error:
>
> > > > cpan> ! require "C:\\strawberry\\perl\\lib\\Crypt\\Makefile.PL"
> > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
> > > > Only one OpenSSL installation found at c:\openssl
> > > > Consider running 'perl Makefile.PL --default' the next
> > > > time Crypt::SSLeay is upgraded to select this directory
> > > > automatically thereby avoiding the following prompt.
> > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
> > > > Which SSL install path do you want to use? [c:\openssl]
> > > > Assuming Vanilla/Strawberry Perl installation
>
> > > > BUILD INFORMATION
> > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> > > > ssl library: OpenSSL 0.9.8 in c:\openssl
> > > > ssl header: =A0openssl/ssl.h
> > > > libraries: =A0 -Lc:\openssl\lib\MinGW -lssleay32 -llibeay32
> > > > include dir: -Ic:\openssl\include
> > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> > > > Could not open 'SSLeay.pm': No such file or directory at C:/strawber=
ry/
> > > > perl/lib/
> > > > ExtUtils/MM_Unix.pm line 2698, <STDIN> line 1.
> > > > Compilation failed in require at (eval 15) line 1, <STDIN> line 1.
>
> > > > Where would I place SSLeay.pm in order for it to be found? I have it=

> > > > within C:/strawberry/perl/lib and at C:/strawberry/perl/lib/Crypt
>
> > > It shouldn't be there before you've installed it.
>
> > > Just unpack the tar.gz file anywhere, cd into the directory and run
>
> > > perl Makefile.PL
> > > make
> > > make test
> > > make install
>
> > > substitude =A0nmake, or whatever make strawberry provides for "make" i=
f that
> > > won't work - it's in strawberry/c/bin.
>
> > Yeah it turned out to be "dmake" instead of "make" or "nmake".
>
> > However, now I get the error "The application failed to run because
> > VSINIT.dll was not found"
>
> Ok I found and downloaded VSINIT.dll, but now I get the following
> error:
>
> "The procedure entry point SSLv2_client_method could not be located in
> the dynamic link library ssleay32.dll"
>
>
>
>
>
> > > Joost.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Got it!! I uninstalled everything, OpenSSL, Crypt, everything (but
Perl itself), wiped out directories and started from scratch.  Got the
latest OpenSSL 0.9.8g Win32 bundle autoexec, then re-downloaded
Crypt::SSLeay, and from the newly-created Crypt folder created from
unbundling the tarball:

perl Makefile.PL
dmake
dmake test
dmake install

Everything ran perfectly!



------------------------------

Date: Sat, 02 Feb 2008 00:38:31 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: Trying to properly use WWW::Mechanize
Message-Id: <87odb0tfgo.fsf@zeekat.nl>

Phil Powell <phillip.s.powell@gmail.com> writes:
> Got it!! I uninstalled everything, OpenSSL, Crypt, everything (but
> Perl itself), wiped out directories and started from scratch.  Got the
> latest OpenSSL 0.9.8g Win32 bundle autoexec, then re-downloaded
> Crypt::SSLeay, and from the newly-created Crypt folder created from
> unbundling the tarball:
>
> perl Makefile.PL
> dmake
> dmake test
> dmake install
>
> Everything ran perfectly!

That's good to know. :-)

I spend the day trying everything to install Wx, Tk and Gtk2 on
strawberry, and finally gave up and settled for Tk on activestate perl.

Joost.


------------------------------

Date: Sat, 02 Feb 2008 02:09:13 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Trying to properly use WWW::Mechanize
Message-Id: <slrnfq7j6o.fcv.tadmc@tadmc30.sbcglobal.net>

Phil Powell <phillip.s.powell@gmail.com> wrote:

> my $mech = WWW::Mechanize->new();
> $mech->get('https://www.example.com');
> my $content = $mech->content;
>
> if ($content ne "") {
>  open(HTML, ">$file");
>  print HTML $content;
>  close(HTML);
>  print "file \"$file\" created\n\n";
> } else {
>  print "unable to create file \"$file\"";
> }


You have a logic error that is independant of the choice of 
programming language.

If you are able to get the resource, but are unable to create
the file, your program will output:

   file "blah/blah.index.html" created

If you are not able to get the resource, your program will output:

   unable to create file "blah/blah.index.html"



You should always, yes *always*, check the return value from open():

    open(HTML, ">$file") or die "could not open '$file' $!";


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

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 1251
***************************************


home help back first fref pref prev next nref lref last post