[31628] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2887 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 25 21:09:27 2010

Date: Thu, 25 Mar 2010 18:09:08 -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           Thu, 25 Mar 2010     Volume: 11 Number: 2887

Today's topics:
    Re: Does $^N only refer to capturing groups? (Seymour J.)
        exec ok in Perl but not as a cron <john1949@yahoo.com>
    Re: exec ok in Perl but not as a cron <ben@morrow.me.uk>
    Re: exec ok in Perl but not as a cron <john1949@yahoo.com>
    Re: exec ok in Perl but not as a cron <glennj@ncf.ca>
    Re: s///gsi; with a wildcard <jwcarlton@gmail.com>
    Re: s///gsi; with a wildcard sln@netherlands.com
    Re: s///gsi; with a wildcard <glex_no-spam@qwest-spam-no.invalid>
    Re: s///gsi; with a wildcard <jwcarlton@gmail.com>
    Re: Show what a substitution is doing ? <willem@turtle.stack.nl>
    Re: Show what a substitution is doing ? <willem@turtle.stack.nl>
    Re: Terms of Use <tzz@lifelogs.com>
        Why doesn't %+ match %- for this regex? (Seymour J.)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 25 Mar 2010 08:09:08 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Does $^N only refer to capturing groups?
Message-Id: <4bab5264$11$fuzhry+tra$mr2ice@news.patriot.net>

In <fabq77-5a2.ln1@osiris.mauzo.dyndns.org>, on 03/24/2010
   at 09:03 PM, Ben Morrow <ben@morrow.me.uk> said:

>I don't think that's possible directly, though if your (?:\d\d) is
>fixed-length you can use something like

>    qr/(?:\d\d)
>       (?(?{ substr(${^MATCH}, -2) > 24 })
>         (*FAIL)
>       )
>    /xp

Thanks. I think that the code will be clearer if I make the group an
unnamed capture and continue using $^N to refer to it. At this point I'm
burning my bridges and relying on named captures for most new patterns, so
I'm less concerned about unintended renumberings than I used to be.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Thu, 25 Mar 2010 11:26:01 -0000
From: "John" <john1949@yahoo.com>
Subject: exec ok in Perl but not as a cron
Message-Id: <hofh88$kuc$1@news.albasani.net>

Hi

exec '/home/john/www/www.example.com/cgi-bin/main.pl automatic';
works OK in Perl program

The following in a crontab:
10 * * * * /home/john/www/www.example.com/cgi-bin/main.pl automatic

produces:-
Can't locate Library.pm in @INC

main.pl begins:-

use lib '../';
use strict;
use warnings;
use Library; my $library=new Library;

Any ideas?

John





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

Date: Thu, 25 Mar 2010 11:46:28 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: exec ok in Perl but not as a cron
Message-Id: <k1vr77-g1f.ln1@osiris.mauzo.dyndns.org>


Quoth "John" <john1949@yahoo.com>:
> 
> exec '/home/john/www/www.example.com/cgi-bin/main.pl automatic';
> works OK in Perl program
> 
> The following in a crontab:
> 10 * * * * /home/john/www/www.example.com/cgi-bin/main.pl automatic
> 
> produces:-
> Can't locate Library.pm in @INC
> 
> main.pl begins:-
> 
> use lib '../';

Here's your problem. cron isn't running the script from the directory
you expect. Put an absolute path there instead.

Ben



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

Date: Thu, 25 Mar 2010 13:45:35 -0000
From: "John" <john1949@yahoo.com>
Subject: Re: exec ok in Perl but not as a cron
Message-Id: <hofpdt$1kh$1@news.albasani.net>


"Ben Morrow" <ben@morrow.me.uk> wrote in message 
news:k1vr77-g1f.ln1@osiris.mauzo.dyndns.org...
>
> Quoth "John" <john1949@yahoo.com>:
>>
>> exec '/home/john/www/www.example.com/cgi-bin/main.pl automatic';
>> works OK in Perl program
>>
>> The following in a crontab:
>> 10 * * * * /home/john/www/www.example.com/cgi-bin/main.pl automatic
>>
>> produces:-
>> Can't locate Library.pm in @INC
>>
>> main.pl begins:-
>>
>> use lib '../';
>
> Here's your problem. cron isn't running the script from the directory
> you expect. Put an absolute path there instead.
>
> Ben
>

Hi

Many thanks.  Done that and it is working from cron.
Regards
John




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

Date: 25 Mar 2010 15:36:54 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: exec ok in Perl but not as a cron
Message-Id: <slrnhqn0om.5j.glennj@smeagol.ncf.ca>

At 2010-03-25 07:26AM, "John" wrote:
>  Hi
>  
>  exec '/home/john/www/www.example.com/cgi-bin/main.pl automatic';
>  works OK in Perl program
>  
>  The following in a crontab:
>  10 * * * * /home/john/www/www.example.com/cgi-bin/main.pl automatic
>  
>  produces:-
>  Can't locate Library.pm in @INC
>  
>  main.pl begins:-
>  
>  use lib '../';
>  use strict;
>  use warnings;
>  use Library; my $library=new Library;
>  
>  Any ideas?

Try putting this in your crontab instead:

   10 * * * * cd /home/john/www/www.example.com/cgi-bin && ./main.pl automatic


-- 
Glenn Jackman
    Write a wise saying and your name will live forever. -- Anonymous


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

Date: Thu, 25 Mar 2010 10:41:09 -0700 (PDT)
From: Jason Carlton <jwcarlton@gmail.com>
Subject: Re: s///gsi; with a wildcard
Message-Id: <7b386882-4a88-46a8-9656-a0d323146b99@z11g2000yqz.googlegroups.com>

On Mar 9, 11:49=A0pm, Jason Carlton <jwcarl...@gmail.com> wrote:
> On Mar 9, 9:21=A0pm, s...@netherlands.com wrote:
>
>
>
>
>
> > On Mon, 8 Mar 2010 19:03:03 -0800 (PST),JasonCarlton<jwcarl...@gmail.co=
m> wrote:
> > >Every once in awhile, someone will copy and paste into my message
> > >board from Word. After it submits through my Perl script, I'll have
> > >something like this plugged in:
>
> > >Normal 0 false false false EN-US X-NONE X-NONE
> > >MicrosoftInternetExplorer4 /* Style Definitions */
> > >table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-
> > >rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-
> > >style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-
> > >padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-
> > >margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:
> > >0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt;
> > >font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso=
-
> > >ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New
> > >Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-
> > >family:Calibri; mso-hansi-theme-font:minor-latin;}
>
> > >The fonts and all that are different for each post; the only
> > >consistency seems to be that it starts with "Normal 0 false false
> > >false", and it ends with a "}".
>
> > >Would something as simple as this be enough to consistently remove it?
>
> > >$comment =3D~ s/Normal 0 false false false.*?}//gsi;
>
> > >Or is there more to it than I'm thinking?
>
> > $comment =3D~ s/Normal 0 false false false[^{]+\{[^}]+\}//;
>
> Thanks, s.

Unfortunately, neither of these are working the way I expected:

$comment =3D~ s/Normal 0 false false false.*?}//gsi;
$comment =3D~ s/Normal 0 false false false[^{]+\{[^}]+\}//;

It's catching the "Normal 0 false false false", but not everything
else that comes after, and before the "}".

How do I make it remove everything from "Normal 0 false false false"
until it finds the first "}"?

TIA,

Jason


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

Date: Thu, 25 Mar 2010 11:52:04 -0700
From: sln@netherlands.com
Subject: Re: s///gsi; with a wildcard
Message-Id: <rn9nq51qliu5h8h72pt85ap9kk194ib64d@4ax.com>

On Thu, 25 Mar 2010 10:41:09 -0700 (PDT), Jason Carlton <jwcarlton@gmail.com> wrote:

>On Mar 9, 11:49 pm, Jason Carlton <jwcarl...@gmail.com> wrote:
>> On Mar 9, 9:21 pm, s...@netherlands.com wrote:
>>
>>
>>
>>
>>
>> > On Mon, 8 Mar 2010 19:03:03 -0800 (PST),JasonCarlton<jwcarl...@gmail.com> wrote:
>> > >Every once in awhile, someone will copy and paste into my message
>> > >board from Word. After it submits through my Perl script, I'll have
>> > >something like this plugged in:
>>
>> > >Normal 0 false false false EN-US X-NONE X-NONE
>> > >MicrosoftInternetExplorer4 /* Style Definitions */
>> > >table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-
>> > >rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-
>> > >style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-
>> > >padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-
>> > >margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:
>> > >0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt;
>> > >font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-
>> > >ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New
>> > >Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-
>> > >family:Calibri; mso-hansi-theme-font:minor-latin;}
>>
>> > >The fonts and all that are different for each post; the only
>> > >consistency seems to be that it starts with "Normal 0 false false
>> > >false", and it ends with a "}".
>>
>> > >Would something as simple as this be enough to consistently remove it?
>>
>> > >$comment =~ s/Normal 0 false false false.*?}//gsi;
>>
>> > >Or is there more to it than I'm thinking?
>>
>> > $comment =~ s/Normal 0 false false false[^{]+\{[^}]+\}//;
>>
>> Thanks, s.
>
>Unfortunately, neither of these are working the way I expected:
>
>$comment =~ s/Normal 0 false false false.*?}//gsi;
>$comment =~ s/Normal 0 false false false[^{]+\{[^}]+\}//;
>
>It's catching the "Normal 0 false false false", but not everything
>else that comes after, and before the "}".
>
>How do I make it remove everything from "Normal 0 false false false"
>until it finds the first "}"?
>
>TIA,
>
>Jason

You can generalize it more:

$comment =~ s/Normal \s* \d+ \s* false \s* false \s* false [^}]* \} //xig;

But, its probably not matching, so the format is different, maybe there
is no terminating '}' in the real text. You don't need /s if you don't have
a '.' in the pattern, thats why  [^}]* \}

Its not a good idea to get everything between the the "Normal" to "}"
as thats not really enough info to make a pattern.

It looks like this:
  Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
is a space delimited set of variable settings, followed by
a '{' block '}' delimeted set of style definitions:

You could use alternation to flag the start the definition if you
know the possible values (the slots look constant), so:

$comment =~ s/ (?:Normal|<something else>) \s* \d+ \s* (?:false|true) \s* (?:false|true) \s* (?:false|true) [^}]* \} //xig;

But, I don't know this format and it possibly can't be relied upon.
Also, the regex has a requirement that it have a style block (or at least something
with a '}' as the terminator.

-sln


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

Date: Thu, 25 Mar 2010 17:45:46 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: s///gsi; with a wildcard
Message-Id: <4babe79a$0$48227$815e3792@news.qwest.net>

Jason Carlton wrote:
> On Mar 9, 11:49 pm, Jason Carlton <jwcarl...@gmail.com> wrote:
>> On Mar 9, 9:21 pm, s...@netherlands.com wrote:
>>
>>
>>
>>
>>
>>> On Mon, 8 Mar 2010 19:03:03 -0800 (PST),JasonCarlton<jwcarl...@gmail.com> wrote:
>>>> Every once in awhile, someone will copy and paste into my message
>>>> board from Word. After it submits through my Perl script, I'll have
>>>> something like this plugged in:
>>>> Normal 0 false false false EN-US X-NONE X-NONE
>>>> MicrosoftInternetExplorer4 /* Style Definitions */
>>>> table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-
>>>> rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-
>>>> style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-
>>>> padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-
>>>> margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:
>>>> 0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt;
>>>> font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-
>>>> ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New
>>>> Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-
>>>> family:Calibri; mso-hansi-theme-font:minor-latin;}
>>>> The fonts and all that are different for each post; the only
>>>> consistency seems to be that it starts with "Normal 0 false false
>>>> false", and it ends with a "}".
>>>> Would something as simple as this be enough to consistently remove it?
>>>> $comment =~ s/Normal 0 false false false.*?}//gsi;
>>>> Or is there more to it than I'm thinking?
>>> $comment =~ s/Normal 0 false false false[^{]+\{[^}]+\}//;
>> Thanks, s.
> 
> Unfortunately, neither of these are working the way I expected:
> 
> $comment =~ s/Normal 0 false false false.*?}//gsi;
> $comment =~ s/Normal 0 false false false[^{]+\{[^}]+\}//;
> 
> It's catching the "Normal 0 false false false", but not everything
> else that comes after, and before the "}".
> 
> How do I make it remove everything from "Normal 0 false false false"
> until it finds the first "}"?

$comment =~ s/Normal 0 false false false[^}]*}//gsi;

my $str = 'Start Normal 0 false false false blah blah { more blah } 
Starting second match Normal 0 false false false blah blah { more blah } 
The End';
$str =~ s/Normal 0 false false false[^}]*}//gsi;
print $str;

Start  Starting second match  The End
	


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

Date: Thu, 25 Mar 2010 16:23:37 -0700 (PDT)
From: Jason Carlton <jwcarlton@gmail.com>
Subject: Re: s///gsi; with a wildcard
Message-Id: <09c0a336-4add-4355-b51a-c669ff461920@35g2000yqm.googlegroups.com>

On Mar 25, 5:45=A0pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> JasonCarltonwrote:
> > On Mar 9, 11:49 pm,JasonCarlton<jwcarl...@gmail.com> wrote:
> >> On Mar 9, 9:21 pm, s...@netherlands.com wrote:
>
> >>> On Mon, 8 Mar 2010 19:03:03 -0800 (PST),JasonCarlton<jwcarl...@gmail.=
com> wrote:
> >>>> Every once in awhile, someone will copy and paste into my message
> >>>> board from Word. After it submits through my Perl script, I'll have
> >>>> something like this plugged in:
> >>>> Normal 0 false false false EN-US X-NONE X-NONE
> >>>> MicrosoftInternetExplorer4 /* Style Definitions */
> >>>> table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-
> >>>> rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso=
-
> >>>> style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-
> >>>> padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-
> >>>> margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-lef=
t:
> >>>> 0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt=
;
> >>>> font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; m=
so-
> >>>> ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New
> >>>> Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-
> >>>> family:Calibri; mso-hansi-theme-font:minor-latin;}
> >>>> The fonts and all that are different for each post; the only
> >>>> consistency seems to be that it starts with "Normal 0 false false
> >>>> false", and it ends with a "}".
> >>>> Would something as simple as this be enough to consistently remove i=
t?
> >>>> $comment =3D~ s/Normal 0 false false false.*?}//gsi;
> >>>> Or is there more to it than I'm thinking?
> >>> $comment =3D~ s/Normal 0 false false false[^{]+\{[^}]+\}//;
> >> Thanks, s.
>
> > Unfortunately, neither of these are working the way I expected:
>
> > $comment =3D~ s/Normal 0 false false false.*?}//gsi;
> > $comment =3D~ s/Normal 0 false false false[^{]+\{[^}]+\}//;
>
> > It's catching the "Normal 0 false false false", but not everything
> > else that comes after, and before the "}".
>
> > How do I make it remove everything from "Normal 0 false false false"
> > until it finds the first "}"?
>
> $comment =3D~ s/Normal 0 false false false[^}]*}//gsi;
>
> my $str =3D 'Start Normal 0 false false false blah blah { more blah }
> Starting second match Normal 0 false false false blah blah { more blah }
> The End';
> $str =3D~ s/Normal 0 false false false[^}]*}//gsi;
> print $str;
>
> Start =A0Starting second match =A0The End

J, should that first "}" be a "{"? Like:

$str =3D~ s/Normal 0 false false false[^{]*}//gsi;


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

Date: Thu, 25 Mar 2010 17:54:12 +0000 (UTC)
From: Willem <willem@turtle.stack.nl>
Subject: Re: Show what a substitution is doing ?
Message-Id: <slrnhqn8q4.2tdq.willem@turtle.stack.nl>

Ben Morrow wrote:
) It shouldn't need to be complicated.
)
)     while ($content =~ /foo(\d+)/g) {
)         my ($start, $end) = ($-[0], $+[0]);
)             # this qq// should contain exactly what you would have put
)             # in the RHS of the s///
)         my $after  = qq/bar$1/;
)         my $before = substr $content, $start, $end, $after;
)     }

I did something similar.  However, because I didn't want to duplicate this
code 5 times, I put it into a function, and that meant hand-parsing for $1,
$2, etc. variables.  Which made it quite complicated.

However, the s///e solution mentioned crossthread had good potential:

 $content =~ s/<complicated expression (with parens)>/
              func("<Another expression with $1 and stuff>")/ge;

 sub func { print "Sub '$&' by '$_[0]'"; $_[0]; }

Which works like a charm.


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: Thu, 25 Mar 2010 17:55:27 +0000 (UTC)
From: Willem <willem@turtle.stack.nl>
Subject: Re: Show what a substitution is doing ?
Message-Id: <slrnhqn8sf.2tdq.willem@turtle.stack.nl>

sln@netherlands.com wrote:
) $content =~ s/(<add key=".*?\.foobar\.)(\d+)(" value="Foo=)(.*?)(;.*?"\/>)/
)    $tmp = $1.'10'.$3.'20'.$5;
)    print "Substitution: '$1$2$3$4$5'\n           => '$tmp'\n";
)    $tmp/eg;

Yep, thanks, that worked quite well.  (I put the expression into
 a function, and used $& instead of $1$2$3$4$5, though.)


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: Thu, 25 Mar 2010 09:58:46 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Terms of Use
Message-Id: <87k4t0mord.fsf@lifelogs.com>

On Wed, 24 Mar 2010 15:49:29 +0100 Mart van de Wege <mvdwege@mail.com> wrote: 

MvdW> Willem <willem@turtle.stack.nl> writes:
>> One could argue that you're *not* allowed to do anything whatsoever
>> with a web page, *except* when the copyright holder allows it.
>> Which he does, obviously, through a terms-of-use agreement.
>> 
MvdW> Yeah, but that works two ways. One could also argue that putting
MvdW> information on a publicly reachable server, using a protocol
MvdW> specifically designed for publishing, without access controls, implies
MvdW> that you want the world to read your pages.

(OT but slightly relevant to WWW::Mechanize for example)

Sadly this common-sense interpretation has been eroded by Congress and
courts in the USA.  Look for info on the Computer Fraud and Abuse Act,
e.g. http://www.techdirt.com/articles/20100305/0404088432.shtml

Ted


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

Date: Thu, 25 Mar 2010 10:24:35 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Why doesn't %+ match %- for this regex?
Message-Id: <4bab7223$14$fuzhry+tra$mr2ice@news.patriot.net>

I'm doing a match using named captures, and the results are puzzling. The
match succeeds, and %- has what I expect, but %+ is empty. I interpolate
the same variable in another pattern and %+ is set as I expect.

The relevant code and output are:

Not working:

 my $RecByPat          = qr!$CFWS
                            BY
                            $FWS
                            (?<BY1>
                              (?:$domainPat                   |
                                 \[ $RE{net}{IPv4} \]
                              )
                            )
                            (?:
                               \s*
                               \(
                                 (?<BY2>[\s\w\./-]+)
                               \)
                            )?
                           !xi;

     foreach (@Received) {
       my $thisStamp = $_;
 #     $thisStamp =~ s/\x0A/\n\t  <LF>\n/;
 #     $thisStamp =~ s/\x0D/\n\t  <CR>\n/;
       msg("\t->$thisStamp\n");
 #     if (/^$RecFromPat $RecByPat/xi) {
       if (/($RecByPat)/xi) {
           print STDERR "\nReceived matched '$1':\n";
           msg("\nDumper(\%+):\n");
           msg(Dumper(%+),"\n");
           msg("\nDumper(\%-):\n");
           msg(Dumper(%-),"\n");
           foreach (sort keys %+) {
             print STDERR "\$+{$_}=$+{$_}\n";
           }
           print STDERR "\n";
       }
     }

Unexpected output:

 @Received has 5 lines
         ->from lincoln-at-leros.patriot.net
(postfix@lincoln-at-leros.patriot.net [209.249.180.104])
         by jefferson.patriot.net (8.13.4/8.13.4/Debian-3sarge3) with
ESMTP id o2M2WK34019242
         for <shmuel+gen@patriot.net>; Sun, 21 Mar 2010 22:32:31 -0400


 Received matched ' (postfix@lincoln-at-leros.patriot.net
[209.249.180.104])
         by jefferson.patriot.net (8.13.4/8.13.4/Debian-3sarge3)':

 Dumper(%+):


 Dumper(-+):
 $VAR1 = 'BY2';
 $VAR2 = [
           '8.13.4/8.13.4/Debian-3sarge3'
         ];
 $VAR3 = 'BY1';
 $VAR4 = [
           'jefferson.patriot.net'
         ];


         ->from localhost (localhost [127.0.0.1])
         by lincoln-at-leros.patriot.net (Postfix) with ESMTP id
C139257346
         for <shmuel+gen@patriot.net>; Sun, 21 Mar 2010 22:29:42 -0400
(EDT)


 Received matched ' (localhost [127.0.0.1])
         by lincoln-at-leros.patriot.net (Postfix)':

 Dumper(%+):


 Dumper(-+):
 $VAR1 = 'BY2';
 $VAR2 = [
           'Postfix'
         ];
 $VAR3 = 'BY1';
 $VAR4 = [
           'lincoln-at-leros.patriot.net'
         ];
         ->from lincoln-at-leros.patriot.net ([127.0.0.1])
         by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024)
         with ESMTP id yovxosQ9IPdL for <shmuel+gen@patriot.net>;
         Sun, 21 Mar 2010 22:29:40 -0400 (EDT)


 Received matched ' ([127.0.0.1])
         by localhost':

 Dumper(%+):


 Dumper(-+):
 $VAR1 = 'BY2';
 $VAR2 = [
           undef
         ];
 $VAR3 = 'BY1';
 $VAR4 = [
           'localhost'
         ];


         ->from smtp.patriot.net (smtp.patriot.net [209.249.176.77])
         by lincoln-at-leros.patriot.net (Postfix) with ESMTP id
439A45734C
         for <shmuel+gen@patriot.net>; Sun, 21 Mar 2010 22:29:40 -0400
(EDT)


 Received matched ' (smtp.patriot.net [209.249.176.77])
         by lincoln-at-leros.patriot.net (Postfix)':

 Dumper(%+):


 Dumper(-+):
 $VAR1 = 'BY2';
 $VAR2 = [
           'Postfix'
         ];
 $VAR3 = 'BY1';
 $VAR4 = [
           'lincoln-at-leros.patriot.net'
         ];


         ->by smtp.patriot.net (Postfix)


Working code:

     if (/^
          from \s+ ($RecHELOpat \s* \( $RecSrcPat \))
          $RecByPat?
         /xi                                                   ||
         /^
          from \s+ ($RecHELOpat \s* \((?<IP>$RE{net}{IPv4})\))
          $RecByPat?
         /xi                                                   ||
         /^
          from \s+ ((\[(?<IP>$RE{net}{IPv4})\]) \s* \(HELO=$RecHELOpat\))
          $RecByPat?
         /xi                                                   ||
         /^
          from \s+ ((?<RDNS>$domainPat) \s+ \((?<IP>\[$RE{net}{IPv4}\])
\s+ HELO=$RecHELOpat\))
          $RecByPat?
         /xi                                                   ||
         /^
          from \s+ ((?<RDNS>$domainPat) \s+ \(HELO\s$RecHELOpat\) \s+
\(\[(?<IP>$RE{net}{IPv4})\]\))
          $RecByPat?
         /xi                                                   ||
         /^
          from \s+ ($QMfromPat)
          $RecByPat?
         /xi                                                   ||
         /^
          from \s+ ($RRfromPat)
          $RecByPat?
         /xi
        )
       {
       if ($debug) {
         print STDERR "\nReceived matched:\n";
         foreach (sort keys %+) {
           print STDERR "\$+{$_}=$+{$_}\n";
         }
         print STDERR "\n";
       }

Any suggestions?

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2887
***************************************


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