[28257] in Perl-Users-Digest
Perl-Users Digest, Issue: 9621 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 17 18:05:44 2006
Date: Thu, 17 Aug 2006 15:05: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, 17 Aug 2006 Volume: 10 Number: 9621
Today's topics:
Re: Do I need to use perl? <markwco@RemoveNoSpamcomcast.net>
get() not working...need help <Shani718@gmail.com>
Re: get() not working...need help <glex_no-spam@qwest-spam-no.invalid>
Re: get() not working...need help usenet@DavidFilmer.com
Re: get() not working...need help <mritty@gmail.com>
Re: get() not working...need help <Shani718@gmail.com>
Re: get() not working...need help <Shani718@gmail.com>
Re: get() not working...need help <benmorrow@tiscali.co.uk>
Re: get() not working...need help <Shani718@gmail.com>
Re: Help Perl and Excel--Multiposted <jgibson@mail.arc.nasa.gov>
Re: how to define a layer between data and functions bpatton@ti.com
Re: how to define a layer between data and functions <benmorrow@tiscali.co.uk>
Re: John Bokma usenet@DavidFilmer.com
Re: My multipost-detecting usenet bot (David Filmer) <john@castleamber.com>
Problems with Win32::Internet FTP->put <aragorn.m@gmail.com>
Re: Problems with Win32::Internet FTP->put <mritty@gmail.com>
qr makes pattern match fail <simon.chao@fmr.com>
Re: qr makes pattern match fail <mritty@gmail.com>
Re: qr makes pattern match fail <1usa@llenroc.ude.invalid>
Re: qr makes pattern match fail <benmorrow@tiscali.co.uk>
Re: qr makes pattern match fail <simon.chao@fmr.com>
Re: qr makes pattern match fail <simon.chao@fmr.com>
Re: qr makes pattern match fail <1usa@llenroc.ude.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 Aug 2006 13:51:05 -0600
From: MarkW <markwco@RemoveNoSpamcomcast.net>
Subject: Re: Do I need to use perl?
Message-Id: <d4i9e29h3303otglpobnh2tk78e6b1c4of@4ax.com>
Thank you for the response. I will do most research on off the shelf
e-commerce solutions and as well will look at the products you
mentioned.
------------------------------
Date: 17 Aug 2006 11:20:58 -0700
From: "Shan" <Shani718@gmail.com>
Subject: get() not working...need help
Message-Id: <1155838858.586884.190410@h48g2000cwc.googlegroups.com>
i have the following piece of code:
GETURL: while (<INFILE>)
{
chomp;
print "$_\n";
my $html = get($_)
...
...
}
the INFILE is a list of URLs. The code works fine for all URLs except
the ones that look like:
http://news.google.com/news?hl=en&ned=us&q=ramsey&btnG=Search+News
Does anyone know why?
Thanks
------------------------------
Date: Thu, 17 Aug 2006 13:33:46 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: get() not working...need help
Message-Id: <44e4b6c6$0$25787$815e3792@news.qwest.net>
Shan wrote:
> i have the following piece of code:
>
> GETURL: while (<INFILE>)
> {
> chomp;
> print "$_\n";
> my $html = get($_)
>
> ...
> ...
>
> }
>
> the INFILE is a list of URLs. The code works fine for all URLs except
> the ones that look like:
> http://news.google.com/news?hl=en&ned=us&q=ramsey&btnG=Search+News
>
> Does anyone know why?
No, since you didn't tell us what didn't work, however you should be
able to have your script tell you why. You'll need to use
LWP::UserAgent, and examine what's returned.
perldoc LWP::UserAgent
Possibly a Cookie issue?
------------------------------
Date: 17 Aug 2006 11:35:48 -0700
From: usenet@DavidFilmer.com
Subject: Re: get() not working...need help
Message-Id: <1155839748.337264.272910@h48g2000cwc.googlegroups.com>
Shan wrote:
> my $html = get($_)
Hmmm... that's a new one for me...
perldoc -f get
No documentation for perl function `get' found
I'm not familiar with the "get" function...
> ...
> ...
Hmmm. I'm not familiar with the '...' command either. Gosh, I gotta
get myself a Perl book or something.
While I'm reading up on my Perl, maybe the OP would like to read up on
some suggestions about how to ask a good question in this newsgroup
(because you can't get a good answer unless you ask a good question).
The OP may find this helpful info in the group's posting guidelines,
found here:
http://www.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 17 Aug 2006 11:40:21 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: get() not working...need help
Message-Id: <1155840021.180716.300250@h48g2000cwc.googlegroups.com>
Shan wrote:
> i have the following piece of code:
>
> GETURL: while (<INFILE>)
> {
> chomp;
> print "$_\n";
> my $html = get($_)
>
> ...
> ...
>
> }
>
> the INFILE is a list of URLs. The code works fine for all URLs except
> the ones that look like:
> http://news.google.com/news?hl=en&ned=us&q=ramsey&btnG=Search+News
What, exactly, does it mean to "look" like the above URL? The only URL
that truly "looks like" that URL *is* that URL.
Please read the Posting Guidelines for this group. They will show you
that the best way to get help here is to post a SHORT but COMPLETE
script that demonstrates your problem, along with sample input and
output.
Paul Lalli
------------------------------
Date: 17 Aug 2006 11:42:08 -0700
From: "Shan" <Shani718@gmail.com>
Subject: Re: get() not working...need help
Message-Id: <1155840127.985425.266390@i3g2000cwc.googlegroups.com>
Well the code parses information and then prints to a file. Nothing is
printed for the url in question but should be printed because the html
contains the data being parsed.
------------------------------
Date: 17 Aug 2006 11:44:01 -0700
From: "Shan" <Shani718@gmail.com>
Subject: Re: get() not working...need help
Message-Id: <1155840241.637815.117590@p79g2000cwp.googlegroups.com>
By look like i mean that exact URL and variations of it ( different
searhc term ). So the word ramsey in the url might be google in a
different url
------------------------------
Date: Thu, 17 Aug 2006 19:42:54 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: get() not working...need help
Message-Id: <euper3-dcs.ln1@osiris.mauzo.dyndns.org>
Quoth "Shan" <Shani718@gmail.com>:
> i have the following piece of code:
>
> GETURL: while (<INFILE>)
> {
> chomp;
> print "$_\n";
> my $html = get($_)
>
> ...
> ...
>
> }
>
> the INFILE is a list of URLs. The code works fine for all URLs except
> the ones that look like:
> http://news.google.com/news?hl=en&ned=us&q=ramsey&btnG=Search+News
>
> Does anyone know why?
news.google.com appears to return 403 Forbidden unless you provide a
recognised User-Agent header. This is presumably in an attempt to stop
people (like you) from scraping the site.
You can of course fake it if you use the proper LWP::UserAgent
interface, but you should check Google's Terms of Use first.
Ben
--
We do not stop playing because we grow old;
we grow old because we stop playing.
benmorrow@tiscali.co.uk
------------------------------
Date: 17 Aug 2006 11:55:19 -0700
From: "Shan" <Shani718@gmail.com>
Subject: Re: get() not working...need help
Message-Id: <1155840919.114131.103460@74g2000cwt.googlegroups.com>
Thank you very much
Ben Morrow wrote:
> Quoth "Shan" <Shani718@gmail.com>:
> > i have the following piece of code:
> >
> > GETURL: while (<INFILE>)
> > {
> > chomp;
> > print "$_\n";
> > my $html = get($_)
> >
> > ...
> > ...
> >
> > }
> >
> > the INFILE is a list of URLs. The code works fine for all URLs except
> > the ones that look like:
> > http://news.google.com/news?hl=en&ned=us&q=ramsey&btnG=Search+News
> >
> > Does anyone know why?
>
> news.google.com appears to return 403 Forbidden unless you provide a
> recognised User-Agent header. This is presumably in an attempt to stop
> people (like you) from scraping the site.
>
> You can of course fake it if you use the proper LWP::UserAgent
> interface, but you should check Google's Terms of Use first.
>
> Ben
>
> --
> We do not stop playing because we grow old;
> we grow old because we stop playing.
> benmorrow@tiscali.co.uk
------------------------------
Date: Thu, 17 Aug 2006 11:16:13 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Help Perl and Excel--Multiposted
Message-Id: <170820061116133882%jgibson@mail.arc.nasa.gov>
In article <1155759179.706268.317300@b28g2000cwb.googlegroups.com>,
<usenet@DavidFilmer.com> wrote:
> use...@DavidFilmer.com wrote:
> > What newsreader are you using? I'd like to do some testing...
>
> Would you mind showing me exactly what the header looks like in your
> reader?
I use Thoth on Mac OS 10.4.7. This is an old newsreader, no longer
under development. (I have tried others, but always come back to
Thoth.) It says it does "Thread By Reference", but maybe it just looks
at the subject line.
The message to which I replied was put in a thread by itself. Perhaps
it is not a problem for others. The message to which I replied is no
longer available from my news server (or so Thoth reports, although I
suspect it still is).
I can forward you another example, when it occurs, but would prefer to
do that via e-mail so as not the clog up the newsgroup on a problem
that only I may be having.
Thanks again.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: 17 Aug 2006 11:32:34 -0700
From: bpatton@ti.com
Subject: Re: how to define a layer between data and functions
Message-Id: <1155839553.961902.312940@m79g2000cwm.googlegroups.com>
This has possibilites.
a hash of anonymous subroutines.
Let me give you a sample of some of the data as it would be in my hash
of data
{ 'Rule Code' => '1A' ,
'Description' => 'some bs',
'layer 1' => 'NWELL',
'relation 1' => 'space' ,
'layer 2 => '',
'drawing size' => '240'
'layer 3' => '',
'relation 2' => '',
'layer 4' => ''
'low range' => '',
'high range' => ''
}
As you can see the evaluations can get quite complex. Expically since
any one of the layers may be a psuedo layer, formed from teh boolean
function between several layers.
What I don't want to do is to have to
if ($h->{relation 1} eq 'space' and $h->{layer 2} eq '' then
the possible permutations would be endless. Since there are currently
just over 2400 of the hashes above, plus the subroutines to build the
psuedo layers, ths nuber of if-then-else would make it next to
impossible to do in my lifetime and completely un maintainable.
Probably get used one time the forgotten because of complexity.
Please tell me more about the use of a hash of anon subroutines.
My concept of teh hash would be
{
'space' => sub { my ($layer1,$layer2,$size) = @_;
create_data();
return 1;
},
'width'=> sub { my ($layer1,$size) = @_;
...
return 1;
}
}
Ok I can visualize how to create the hash of subroutines that
represents how to act upon my keywords.
But how to loop through my data hash and call the correct routines.
Can I make calls to determine what the prototyes of the anon are?
maybe match the prototypes with the data.
I remember reading something about getting the prototypes fro a
subroutine
return unless this exists and that
exists
Ben Morrow wrote:
> Quoth bpatton@ti.com:
> > I believe if there were some method to have an engine that would match
> > data up with functions without to having to manually type all those
> > if-then-else this would allow me to easily expand the amount of
> > keywords.
>
> I don't think I entirely understand what you're asking, but one way of
> doing something like this is having a hash of anon subs. That way you
> have a main loop that goes through the data, looking each one up in the
> hash and executing the given code.
>
> Ben
>
> --
> Outside of a dog, a book is a man's best friend.
> Inside of a dog, it's too dark to read.
> benmorrow@tiscali.co.uk Groucho Marx
------------------------------
Date: Thu, 17 Aug 2006 19:57:09 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: how to define a layer between data and functions
Message-Id: <5pqer3-vns.ln1@osiris.mauzo.dyndns.org>
[please don't top-post. have you read the Posting Guidelines?]
Quoth bpatton@ti.com:
> This has possibilites.
> a hash of anonymous subroutines.
>
> Let me give you a sample of some of the data as it would be in my hash
> of data
> { 'Rule Code' => '1A' ,
> 'Description' => 'some bs',
> 'layer 1' => 'NWELL',
> 'relation 1' => 'space' ,
> 'layer 2 => '',
> 'drawing size' => '240'
> 'layer 3' => '',
> 'relation 2' => '',
> 'layer 4' => ''
> 'low range' => '',
> 'high range' => ''
> }
>
> As you can see the evaluations can get quite complex. Expically since
> any one of the layers may be a psuedo layer, formed from teh boolean
> function between several layers.
Err... no, I can't see anything from that. I have no idea what any of
the above represent or how they are related.
> Please tell me more about the use of a hash of anon subroutines.
> My concept of teh hash would be
> {
> 'space' => sub { my ($layer1,$layer2,$size) = @_;
> create_data();
> return 1;
> },
> 'width'=> sub { my ($layer1,$size) = @_;
> ...
> return 1;
> }
> }
Yes, that's the basic idea.
> Ok I can visualize how to create the hash of subroutines that
> represents how to act upon my keywords.
> But how to loop through my data hash and call the correct routines.
Assuming the above is assigned to $dispatch, you can call a sub with
e.g.
$dispatch->{space}->('NWELL', '', 240);
See perlref.
> Can I make calls to determine what the prototyes of the anon are?
Err... yes, you can get the prototype of a sub with the prototype()
builtin function. Note that none of your subs above have prototypes... I
suspect you're on a wrong track here. You may need to store some
metadata about each sub alongside it, something like
my $dispatch = {
space => {
ARGS => 3,
SUB => sub {
my ($layer1, $layer2, $size) = @_;
...
},
},
...
};
Ben
--
Like all men in Babylon I have been a proconsul; like all, a slave ... During
one lunar year, I have been declared invisible; I shrieked and was not heard,
I stole my bread and was not decapitated.
~ benmorrow@tiscali.co.uk ~ Jorge Luis Borges, 'The Babylon Lottery'
------------------------------
Date: 17 Aug 2006 14:55:43 -0700
From: usenet@DavidFilmer.com
Subject: Re: John Bokma
Message-Id: <1155851743.266615.227040@74g2000cwt.googlegroups.com>
John W. Krahn wrote:
> Your URL points to a posting on c.l.p.misc, there is no such posting on the
> beginners@perl.org mailing list.
Yeah, sorry, I was bouncing around and thought I was in a different
group when I read the flame. The point is still valid though... anyone
who will flame a guy like Randal (one of the nicest, most helpful, and
most knowledgeable Perl guys in the world) is a nut job.
Apparently, as Sinan pointed out, this guy is suspiciously similar to
another troll that is also anti-Randal. Now I can see where JohnB
might get somebody upset - as he readily admits, he can be a hothead
sometimes (he went all Xah Lee on me a couple of days ago when I did
something that I should have done differently). But I've never seen
anything that would make someone want to launch a flame crusade against
Randal. What has Randal ever done to piss somebody off in the
southeast?
But I guess there are nut jobs everywhere.
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 17 Aug 2006 18:05:43 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: My multipost-detecting usenet bot (David Filmer)
Message-Id: <Xns98228533E43D1castleamber@130.133.1.4>
usenet@DavidFilmer.com wrote:
> Ben Morrow wrote:
>> Something you could perhaps try is keeping a database of all your
>> bot's posts
>
> already do that...
>
>> and cancelling them if the original article gets cancelled.
>
> Not sure how to do that... can I query for canceled jobs?
yes, those are posted in control.cancel
> Of course, in this particular case, apparently a message was canceled
> on John's newsserver but not on mine (GigaNews). The bot runs on
> GigaNews; it has no way to know about cancels on other servers.
I am not sure about that one. I know a bit about Usenet, but no idea if
cancels that are not honored might show up in control.cancel anyway.
> I have never heard anything negative about GigaNews (such as that they
> don't honor cancels). One thing I can say for sure about GN - it's
> darn fast. But, if I find that they routinely don't honor cancels
> that other servers do, I'll regroup.
Newsservers are connected and have up and down feeds, and each have their
own cancel policy. If A sends cancels to B, and B propogates them to C,
and C decideds not to propogate them further they never reach D (for
example).
individual.net was free, but costs now (since 2 years) 10 euro/year (about
10 USD).
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 17 Aug 2006 14:26:02 -0700
From: "AJ" <aragorn.m@gmail.com>
Subject: Problems with Win32::Internet FTP->put
Message-Id: <1155849962.101545.286640@b28g2000cwb.googlegroups.com>
I can't seem to get a file to "put" onto an FTP server. I can "get"
files without issue. I don't receive any errors from my last print
statement below (I just get "transferred failed []"). I have gone to
specifying a test file by name instead of a variable, still no luck.
Anyone have any insights?
Here is the code:
use Win32::Internet;
$inet = new Win32::Internet();
$inet->FTP($MYFTPSRV, "ftpsrv", "ftpuser", "ftppassword");
if ($MYFTPSRV->Cd("/FromHost")) {
print "cd sucess\n";
if ($MYFTPSRV->Put("c:/temp/testfile.tst")){
print "put success\n";
} else { print "transfer failed [$@]\n";
}
}
$inet->Close($MYFTPSRV);
Thanks,
--AJ
------------------------------
Date: 17 Aug 2006 14:32:26 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Problems with Win32::Internet FTP->put
Message-Id: <1155850346.695655.37970@h48g2000cwc.googlegroups.com>
AJ wrote:
> I can't seem to get a file to "put" onto an FTP server. I can "get"
> files without issue. I don't receive any errors from my last print
> statement below (I just get "transferred failed []"). I have gone to
> specifying a test file by name instead of a variable, still no luck.
>
> Anyone have any insights?
>
> Here is the code:
>
> use Win32::Internet;
> $inet = new Win32::Internet();
> $inet->FTP($MYFTPSRV, "ftpsrv", "ftpuser", "ftppassword");
> if ($MYFTPSRV->Cd("/FromHost")) {
> print "cd sucess\n";
> if ($MYFTPSRV->Put("c:/temp/testfile.tst")){
> print "put success\n";
> } else { print "transfer failed [$@]\n";
> }
> }
> $inet->Close($MYFTPSRV);
I have no idea what's making you think $@ would contain an error
message. There's no mention of $@ in the documentation. Please search
the docs for the Error() and GetResponse() methods. Once you've
determined the reason for the failure, if you can't figure out what's
wrong, post here again, with your updated script and error output.
Paul Lalli
------------------------------
Date: 17 Aug 2006 11:24:53 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: qr makes pattern match fail
Message-Id: <1155839093.785576.270340@m79g2000cwm.googlegroups.com>
i think i just need a fresh set of eyes. why would pre-compiling the
pattern make this fail?
#!/usr/bin/perl
use strict; use warnings;
my $entry = qr/login\/response/; # prints "did not match.".
# my $entry = 'login/response'; # prints "matched."
print $entry, "\n";
my $record = q{08/16/2006 00:00:01 GET
/ftgw/Fas/Fidelity/RtlCust/Login/Response blah blah};
if ( $record =~ m/$entry/i ) {
print "matched.\n";
}
else {
print "did not match.\n";
}
------------------------------
Date: 17 Aug 2006 11:31:22 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: qr makes pattern match fail
Message-Id: <1155839482.592681.266800@i42g2000cwa.googlegroups.com>
it_says_BALLS_on_your forehead wrote:
> i think i just need a fresh set of eyes. why would pre-compiling the
> pattern make this fail?
>
> #!/usr/bin/perl
>
> use strict; use warnings;
>
> my $entry = qr/login\/response/; # prints "did not match.".
> # my $entry = 'login/response'; # prints "matched."
>
> print $entry, "\n";
>
> my $record = q{08/16/2006 00:00:01 GET
> /ftgw/Fas/Fidelity/RtlCust/Login/Response blah blah};
>
> if ( $record =~ m/$entry/i ) {
> print "matched.\n";
> }
> else {
> print "did not match.\n";
> }
Relatively certain it's because your pre-compiled regular expression is
very specifically not case insensitive. The /i flag on the "outer"
regexp doesn't affect that. If you put the /i flag on the pre-compiled
regexp, it matches.
Paul Lalli
------------------------------
Date: Thu, 17 Aug 2006 18:34:17 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: qr makes pattern match fail
Message-Id: <Xns98229454CFE2Dasu1cornelledu@127.0.0.1>
"it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote in
news:1155839093.785576.270340@m79g2000cwm.googlegroups.com:
> i think i just need a fresh set of eyes. why would pre-compiling the
> pattern make this fail?
>
> #!/usr/bin/perl
>
> use strict; use warnings;
>
> my $entry = qr/login\/response/; # prints "did not match.".
> # my $entry = 'login/response'; # prints "matched."
>
> print $entry, "\n";
>
> my $record = q{08/16/2006 00:00:01 GET
> /ftgw/Fas/Fidelity/RtlCust/Login/Response blah blah};
>
> if ( $record =~ m/$entry/i ) {
> print "matched.\n";
> }
Well, take a look at what gets printed when you print $entry. The i flag
in the match in the if condition does not affect what's inside the qr.
That is, the qr version is case sensitive.
Recommend YAPE::Explain.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Thu, 17 Aug 2006 19:46:45 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: qr makes pattern match fail
Message-Id: <l5qer3-dcs.ln1@osiris.mauzo.dyndns.org>
Quoth "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>:
> i think i just need a fresh set of eyes. why would pre-compiling the
> pattern make this fail?
>
> #!/usr/bin/perl
>
> use strict; use warnings;
>
> my $entry = qr/login\/response/; # prints "did not match.".
If you use different delimiters you don't need the \.
> # my $entry = 'login/response'; # prints "matched."
>
> print $entry, "\n";
If you set $\ Perl will print the "\n" for you.
>
> my $record = q{08/16/2006 00:00:01 GET
> /ftgw/Fas/Fidelity/RtlCust/Login/Response blah blah};
>
> if ( $record =~ m/$entry/i ) {
> print "matched.\n";
> }
> else {
> print "did not match.\n";
> }
If you print the compiled regex you'll see why. qr// encapsulates the
state of the /ismx flags in the regex (it's part of the compiling
process), so you need
my $entry = qr{login/response}i;
Then you can match with just $record =~ $entry.
Ben
--
I have two words that are going to make all your troubles go away.
"Miniature". "Golf".
[benmorrow@tiscali.co.uk]
------------------------------
Date: 17 Aug 2006 12:09:44 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: qr makes pattern match fail
Message-Id: <1155841784.562550.112180@b28g2000cwb.googlegroups.com>
Paul Lalli wrote:
> it_says_BALLS_on_your forehead wrote:
> > i think i just need a fresh set of eyes. why would pre-compiling the
> > pattern make this fail?
> >
> > #!/usr/bin/perl
> >
> > use strict; use warnings;
> >
> > my $entry = qr/login\/response/; # prints "did not match.".
> > # my $entry = 'login/response'; # prints "matched."
> >
> > print $entry, "\n";
> >
> > my $record = q{08/16/2006 00:00:01 GET
> > /ftgw/Fas/Fidelity/RtlCust/Login/Response blah blah};
> >
> > if ( $record =~ m/$entry/i ) {
> > print "matched.\n";
> > }
> > else {
> > print "did not match.\n";
> > }
>
> Relatively certain it's because your pre-compiled regular expression is
> very specifically not case insensitive. The /i flag on the "outer"
> regexp doesn't affect that. If you put the /i flag on the pre-compiled
> regexp, it matches.
ahh, duh! thx Paul.
------------------------------
Date: 17 Aug 2006 12:50:51 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: qr makes pattern match fail
Message-Id: <1155844251.310002.109240@i42g2000cwa.googlegroups.com>
A. Sinan Unur wrote:
> "it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote in
> news:1155839093.785576.270340@m79g2000cwm.googlegroups.com:
>
> > i think i just need a fresh set of eyes. why would pre-compiling the
> > pattern make this fail?
> >
> > #!/usr/bin/perl
> >
> > use strict; use warnings;
> >
> > my $entry = qr/login\/response/; # prints "did not match.".
> > # my $entry = 'login/response'; # prints "matched."
> >
> > print $entry, "\n";
> >
> > my $record = q{08/16/2006 00:00:01 GET
> > /ftgw/Fas/Fidelity/RtlCust/Login/Response blah blah};
> >
> > if ( $record =~ m/$entry/i ) {
> > print "matched.\n";
> > }
>
> Well, take a look at what gets printed when you print $entry. The i flag
> in the match in the if condition does not affect what's inside the qr.
> That is, the qr version is case sensitive.
>
> Recommend YAPE::Explain.
couldn't find YAPE::Explain on cpan, but I did find
YAPE::Regex::Explain ;-).
Thx A. Sinan.
------------------------------
Date: Thu, 17 Aug 2006 20:09:25 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: qr makes pattern match fail
Message-Id: <Xns9822A47562F20asu1cornelledu@127.0.0.1>
"it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote in
news:1155844251.310002.109240@i42g2000cwa.googlegroups.com:
>
> A. Sinan Unur wrote:
...
>> Recommend YAPE::Explain.
>
> couldn't find YAPE::Explain on cpan, but I did find
> YAPE::Regex::Explain ;-).
Well, I knew you could fill in the blanks ;-)
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
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 V10 Issue 9621
***************************************