[21760] in Perl-Users-Digest
Perl-Users Digest, Issue: 3964 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 14 00:09:19 2002
Date: Sun, 13 Oct 2002 21: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 Sun, 13 Oct 2002 Volume: 10 Number: 3964
Today's topics:
Re: Array Assigning problem .. (Tad McClellan)
Re: Checking array values for null values <usenet@tinita.de>
Documentation about this \Q \E stuff <yoman@dude.com>
Re: Documentation about this \Q \E stuff <ak@freeshell.org.REMOVE>
Re: Email link to a word Document (David Efflandt)
File download/copy to client subdirectory (Ravi)
io::select and individual response times <smackdab1@hotmail.com>
Re: Multiple Pings/Second <smackdab1@hotmail.com>
net::ftp errors <stuff@nowhere.com>
Re: Perl 5.8 test failure <rsteinmetz@mindspring.com>
Perl script works half the time <yoman@dude.com>
Re: Perl script works half the time <usenet@tinita.de>
Re: Perl script works half the time <usenet@tinita.de>
Re: Perl script works half the time <yoman@dude.com>
Re: Perl script works half the time <bwalton@rochester.rr.com>
Re: Perl script works half the time <yoman@dude.com>
Re: Perl script works half the time <mgjv@tradingpost.com.au>
Re: Perl script works half the time <mgjv@tradingpost.com.au>
Re: Perl script works half the time <usenet@tinita.de>
Re: Perl script works half the time <yoman@dude.com>
Re: Perl script works half the time <yoman@dude.com>
Re: Perl script works half the time <yoman@dude.com>
Re: question from beginner >_< <pkent77tea@yahoo.com.tea>
Regular Expression (Referer) (kazchan)
Re: Using Perl to solve interesting Banking Probm .. <s.patterson@freeuk.com>
Re: Using Perl to solve interesting Banking Probm .. <wblock@wonkity.com>
Re: What purpose does eval{ ... } server? <mgjv@tradingpost.com.au>
Re: What purpose does eval{ ... } server? <nospam@nospam.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 13 Oct 2002 22:30:36 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Array Assigning problem ..
Message-Id: <slrnaqkeis.21v.tadmc@magna.augustmail.com>
KM <ken_mahi@hotmail.com> wrote:
> @sym = qw (Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey,
> Rooster, Dog, Pig);
You should always enable warnings when developing Perl code!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Oct 2002 23:15:09 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Checking array values for null values
Message-Id: <aocupt$l8pj2$2@fu-berlin.de>
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> Tina Mueller wrote:
>>
>> unless (grep (!length, @array[0..4]) {
>> print "All there!\n"
>> }
> Double negatives are wierd... I would prefer:
> if( grep !length, @array[0..4] ) {
> print "Missing Some\n"
> } else {
> print "All there!\n"
> }
yep, see <ams0ms$8m3a6$1@fu-berlin.de>
tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/ \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Sun, 13 Oct 2002 22:11:55 -0400
From: some guy <yoman@dude.com>
Subject: Documentation about this \Q \E stuff
Message-Id: <3daa278d$1_2@nopics.sjc>
Hi,
can someone point me to a place where I can read about the \Q and \E
stuff?
thanks.
------------------------------
Date: Mon, 14 Oct 2002 02:47:25 -0000
From: Andreas =?iso-8859-1?Q?K=E4h=E4ri?= <ak@freeshell.org.REMOVE>
Subject: Re: Documentation about this \Q \E stuff
Message-Id: <slrnaqkc1p.70v.ak@otaku.freeshell.org>
Submitted by "some guy" to comp.lang.perl.misc:
> Hi,
>
> can someone point me to a place where I can read about the \Q and \E
> stuff?
>
> thanks.
"perldoc perlre"
--
Andreas Kähäri @ New Zealand +------ Have a Unix: netbsd.org
-----------------------------+------ This post ends with :wq
------------------------------
Date: Mon, 14 Oct 2002 03:56:03 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Email link to a word Document
Message-Id: <slrnaqkg2j.3fe.efflandt@typhoon.xnet.com>
On Sun, 13 Oct 2002 16:18:45 GMT, Andras Malatinszky <nobody@dev.null> wrote:
>
>
> GetWebWise wrote:
>
>> Hi there
>>
>> I am a real perl/html novice....
>>
>> II am using a form to send an email, in which I would like a link to a word
>> document or zip file.
>>
>> Please can someone help me understand how to make this work.
>>
>> # open(REPLY, "|/usr/sbin/sendmail -t");
>> # print REPLY "To: $email \n"; # SEND TO ENQUIRER
>> # print REPLY "From: $emailsales \n";
>> # print REPLY "Subject: Internet Enquiry \n";
Your last header should end with a blank line (or double newline) above.
Any particular reason you have a trailing space on each line?
>> # print REPLY "Dear $fn \n";
>> # print REPLY "I have just received your enquiry which is being processed.
>> \n";
>> # print REPLY " \n";
>>
>> This is the part I cannot seem to make work??? -----------
>> # print REPLY "<HREF="http://www.cleanandeasymoney.co.uk/cgi-
>> # bin/infopack/infopack.doc">Click Here to Download Information Pack>
>> \n\n";
>>
>> Thank you
>> Ian
>>
>>
>
> Well, you can start by uncommenting your code :-)
>
> Your biggest problem is that you are trying to nest double quotes within
> double quotes in your last print statement. Instead, you could do
> something along the lines of
>
> print REPLY qq[<a href="http://www.sleazymoney.con">Avoid me</a>\n\n];
>
> You have other problems, too. The HTML you are printing is totally
> bogus. Your HREF wants an A before it and you also need a closing </A> tag.
Not to metion the fact that it is not even html mail. Most plain text
mail readers will recognize and allow following a URL (even pine if
properly configured). The exteranious (malformed) HTML just adds clutter.
--
David Efflandt - All spam ignored http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: 13 Oct 2002 20:02:33 -0700
From: ranam@ue.com.au (Ravi)
Subject: File download/copy to client subdirectory
Message-Id: <66d1df6a.0210131902.49ce4773@posting.google.com>
Hi All,
I'm trying to write a script in perl to download a binary file from my
webserver to a specific directory in the client's PC. For example,
I'd like to put the binary file in "c:\a_drive" and nowhere else.
Can this be done without having to prompt the user where to place the
file ? Any info towards this will be much appreciated. Thanks.
ravi...
------------------------------
Date: Mon, 14 Oct 2002 02:40:54 GMT
From: "smackdab" <smackdab1@hotmail.com>
Subject: io::select and individual response times
Message-Id: <W8qq9.146281$S32.10450423@news2.west.cox.net>
I am sending a couple of non-blocking TCP connect calls at once...
I then do a $select->can_write($timeout) to see how many accepted my
connection requests...
Is there any way to get timing info from each connection?
I can set a hires time before I send out the connects, but since the
can_write()
blocks I don't know when individual ones came back...
I think I looked through all of the IO::Socket and IO::Select pod pages but
didn't see anything
to do this.
thanks for any suggestions!
------------------------------
Date: Mon, 14 Oct 2002 01:26:49 GMT
From: "smackdab" <smackdab1@hotmail.com>
Subject: Re: Multiple Pings/Second
Message-Id: <t3pq9.146211$S32.10432956@news2.west.cox.net>
Thanks!!!
I am on Win32 and the $^E was helpful...I made the recv buffer 1500 and it
got farther!
Also, using either of these, allowed the code to send - yea, even farther!
> if( vec $wvec, fileno($socket), 1 ) {
> Or perhaps to:
> if( $wvec eq $svec ) {
But,things weren't coming back as a valid packet...
So, after the recv() I added this line to grab the "end" of the string to
unpack()
(I think Net::Ping is doing this...)
($resp) = $resp =~ m/(.{8})$/;
This allowed $rtype and $rpid to validate, but $rchk != the checksum
# make sure this is a valid packet:
$rtype == 0 and $rpid == ($$ & 0xFFFF)
and defined $checksums[$rseq]
and $rchk == $checksums[$rseq][1] or next;
I copied the Net::Ping checksum() function and used it, no change.
Pack puts one checksum value in, but I don't get it back.
It seems $rchk is before $rpid, so I am not sure where the checksum
"corruption" is coming from...
my ($rtype, undef, $rchk, $rpid, $rseq) =
unpack("C2S3", $resp);
Am I on a wild goose chase with the line I added above to get the 'end' of
the string???
thanks for any ideas...
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3DA9D833.FD84E5F@earthlink.net...
> smackdab wrote:
> >
> > Wow what great timing...I was looking @ trying to do this, gave up and
> > then saw these posts. I have used an example of yours for nonblocking
> > port scanning, which works great (took me a while to understand it
> > though...)
> > It used IO::Select, which seems easier for us beginners...
> >
> > I can't get this to run, I currently get
> > Error in recv: Unknown error at test.pl line 53.
> > Here are the lines:
> > my $resp = "";
> > my $responder = recv( $socket, $resp, 8, 0 )
> > or die "Error in recv: $!"; # shouldn't happen.
>
> Whenever I see $! produce an "Unknown error" string, I try changing it
> to $^E... then, if that doesn't print anything useful, I try printing
> out the numeric value of $! or $^E, and then doing a google search to
> find out which Windows Socket Error that is.
>
> If you're not on windows, this advice might not help (there are other
> systems than windows where $^E prints something more useful than $!, but
> obviously on non-windows platforms you can't lookup WSA-errors)
>
> > (I changed the my ($resp), as I saw the above in another book, but
> > it didn't help...). $socket is valid at this point...
> >
> > This line was confusing, so I dropped the $t as my book only
> > said 1 thing came back from this call...
> > I noticed that IO::Select->select() returns 3 things though...
> > #(my ($n), $t) = select($rvec, $wvec, '', 0.5);
> > my $n = select($rvec, $wvec, '', 0.5);
>
> Hmm... I suppose that if you don't use $t (which an earlier version of
> my code did), then they are equivilant.
>
> > It *seems* to create the socket and call the select, but I never
> > see it call send().
> >
> > This line:
> > if( $wvec =~ tr/^\0// ) {
> > Is it looking for a NULL in a buffer...
>
> No, it is looking for a NON-nul in the w-vector.
>
> > don't understand this whole part, as $wvec is a "@" or a "." ... well
> > beyond me ;-)
>
> The $wvec variable is a bitvector, created with vec(). The only
> properties of it that we care about are whether or not:
> vec( $wvec, fileno($socket), 1 )
> is a true expression.
>
> It will have a value of "", or of "\000", or (assuming that
> fileno($socket) is 3), "\008", which is an unprintable character.
>
> The string "\000" prints out as "^@" on many systems. I don't see how
> you got the string "." ... that seems to be an impossible value.
>
> If it makes more sense to you, consider changing the if statement from:
> if( $wvec =~ tr/^\0// ) {
> to:
> if( vec $wvec, fileno($socket), 1 ) {
> Or perhaps to:
> if( $wvec eq $svec ) {
>
> --
> my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
> ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Mon, 14 Oct 2002 13:34:50 +1000
From: "mostuff" <stuff@nowhere.com>
Subject: net::ftp errors
Message-Id: <ZYqq9.85$Db.11478@nasal.pacific.net.au>
hi. i'm using net::ftp to upload file to an ftp site (duh ;)). if it has an
error connecting $! is always Uknown error. i've noticed that if i use
win32::getlasterror() it will return the winsock error code (11001 etc.). is
there any other way of getting a more verbose error message out of net::ftp?
thanx in advance
------------------------------
Date: Sun, 13 Oct 2002 23:14:20 GMT
From: Rob <rsteinmetz@mindspring.com>
Subject: Re: Perl 5.8 test failure
Message-Id: <3DA9FE4C.6000708@mindspring.com>
Rafael Garcia-Suarez wrote:
>Rob wrote in comp.lang.perl.misc :
>
>>I have a web server running an old version of Suse Linux, I got caught
>>in a upgrade cascade trying to add some capabilities.
>>
>>I wanted to up upgrade the Perl installation to 5.8 and it compiled
>>without failure but make test failed on Users:pwent. It was the only
>>failure.
>>
>>I ran the additional test recommended but it did not give any more
>>information. I also tried to compile 5.6.1, with identical results.
>>
>>Any suggestions on what may be wrong or how to go about tracking it down?
>>
>
>I've already seen this test failure on SuSe systems.
>
>Apparently, the test makes some basic assumptions about the format of
>your /etc/passwd, but your system uses a specific format, or has
>specific users, or something. This is typically unportable, hence hard
>to test.
>
>Don't bother about this test, your perl most probably runs fine.
>
>Can you post the full output of the test lib/User/pwent.t ?
>(Or send it to me.)
>
As far as I can tell the /etc/passwd format is identical to every other
Unix like system I've worked with (Xenix, SCO Unix SunOS 4.x, Solaris
2.x, SunOS 3.x, and Ultrix). I have found some similar posts regarding
HP/UX. I'm not that familiar with perl installs, how can I get the
specific results? 'Make test' only reports that test 1 on pwent fails
and harness does much the same, it reports that test 1 of 2 fails.
--
Rob
"Never ascribe to malice that which can be adequately explained by stupidity"
------------------------------
Date: Sun, 13 Oct 2002 18:59:16 -0400
From: some guy <yoman@dude.com>
Subject: Perl script works half the time
Message-Id: <3da9fa65$1_7@nopics.sjc>
Hi,
I wrote a script for my website on tripod.com and half the time it works,
but half the time it doesn't seem to like one of my regular expressions
and generates the following error msg
regexp reset interpolation flag trapped by operation mask at grades.cgi
line 25
The regular expression that it doesn't like looks like the following
$entry =~ /[ \w]+\:\:$thePassword\:\:/i
Thanks for any help you can give. I am beginning to conclude that
tripod.com has got a broken perl implementation. But I have learned to
believe never blame it on the implementation.
------------------------------
Date: 13 Oct 2002 23:36:17 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Perl script works half the time
Message-Id: <aod01h$ljsvh$1@fu-berlin.de>
some guy <yoman@dude.com> wrote:
> I wrote a script for my website on tripod.com and half the time it works,
> but half the time it doesn't seem to like one of my regular expressions
> and generates the following error msg
> regexp reset interpolation flag trapped by operation mask at grades.cgi
> line 25
> The regular expression that it doesn't like looks like the following
> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
it looks like or it looks exactly like?
consider $thePassword contains ".*".
then this would *always* match.
variables are interpolated in a regex, so you have to
escape special characters.
either do:
$safe = quotemeta $regex;
$string =~ m/$safe/;
or
$string =~ m/\Q$regex\E/;
for more info have a look at perldoc -f quotemeta
hth, tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/ \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 13 Oct 2002 23:40:04 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Perl script works half the time
Message-Id: <aod08k$ljsvh$2@fu-berlin.de>
Tina Mueller <usenet@tinita.de> wrote:
> some guy <yoman@dude.com> wrote:
[checking passwd]
you might also want to use
my $pwd = (getpwuid($uid))[1];
perldoc perlfunc
hth, tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/ \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Sun, 13 Oct 2002 19:52:06 -0400
From: some guy <yoman@dude.com>
Subject: Re: Perl script works half the time
Message-Id: <3daa06c8$1_4@nopics.sjc>
On Sun, 13 Oct 2002 20:36:17 -0400, Tina Mueller wrote:
> some guy <yoman@dude.com> wrote:
>
>> I wrote a script for my website on tripod.com and half the time it
>> works, but half the time it doesn't seem to like one of my regular
>> expressions and generates the following error msg
>
>> regexp reset interpolation flag trapped by operation mask at grades.cgi
>> line 25
>
>> The regular expression that it doesn't like looks like the following
>
>> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>
> it looks like or it looks exactly like? consider $thePassword contains
> ".*".
> then this would *always* match.
>
> variables are interpolated in a regex, so you have to escape special
> characters.
> either do:
> $safe = quotemeta $regex;
> $string =~ m/$safe/;
>
> or
> $string =~ m/\Q$regex\E/;
>
> for more info have a look at perldoc -f quotemeta
>
> hth, tina
But I am controling the $thePassword variable and it never contains any
characters that need to be escaped.
------------------------------
Date: Mon, 14 Oct 2002 00:01:07 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl script works half the time
Message-Id: <3DAA0937.2020707@rochester.rr.com>
some guy wrote:
> Hi,
>
> I wrote a script for my website on tripod.com and half the time it works,
> but half the time it doesn't seem to like one of my regular expressions
> and generates the following error msg
>
> regexp reset interpolation flag trapped by operation mask at grades.cgi
> line 25
>
>
> The regular expression that it doesn't like looks like the following
>
> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>
> Thanks for any help you can give. I am beginning to conclude that
> tripod.com has got a broken perl implementation. But I have learned to
> believe never blame it on the implementation.
>
Does $thePassword come from the user? If so, it may contain regex
metacharacters. It would be possible to get various errors depending
upon the exact combination of characters used. Perhaps if you
quote-meta'ed them, maybe something like:
$entry =~/[ \w]+::\Q$thePassword\E::/i;
it would work better? (Note: I also deleted unneeded backslashes --
but in your original expression, the backslash before the third colon
was needed in order to avoid referencing variable $thePassword:: .)
There might still be a few dicey cases, like when $thePassword contains
some colons, perhaps -- so you might find it still doesn't actually do
what you want it to do.
--
Bob Walton
------------------------------
Date: Sun, 13 Oct 2002 20:08:57 -0400
From: some guy <yoman@dude.com>
Subject: Re: Perl script works half the time
Message-Id: <3daa0abc$1_1@nopics.sjc>
On Sun, 13 Oct 2002 21:01:07 -0400, Bob Walton wrote:
> some guy wrote:
>
>> Hi,
>>
>> I wrote a script for my website on tripod.com and half the time it
>> works, but half the time it doesn't seem to like one of my regular
>> expressions and generates the following error msg
>>
>> regexp reset interpolation flag trapped by operation mask at grades.cgi
>> line 25
>>
>>
>> The regular expression that it doesn't like looks like the following
>>
>> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>>
>> Thanks for any help you can give. I am beginning to conclude that
>> tripod.com has got a broken perl implementation. But I have learned to
>> believe never blame it on the implementation.
>>
>>
> Does $thePassword come from the user? If so, it may contain regex
> metacharacters. It would be possible to get various errors depending
> upon the exact combination of characters used. Perhaps if you
> quote-meta'ed them, maybe something like:
>
> $entry =~/[ \w]+::\Q$thePassword\E::/i;
>
> it would work better? (Note: I also deleted unneeded backslashes --
> but in your original expression, the backslash before the third colon
> was needed in order to avoid referencing variable $thePassword:: .)
>
> There might still be a few dicey cases, like when $thePassword contains
> some colons, perhaps -- so you might find it still doesn't actually do
> what you want it to do.
The $thePassword is controlled by me and will never contain characters
which would otherwise need escaping. Is the tripod.com perl
implementation just broken?
------------------------------
Date: Mon, 14 Oct 2002 10:16:32 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Perl script works half the time
Message-Id: <slrnaqk370.q36.mgjv@martien.heliotrope.home>
On Sun, 13 Oct 2002 18:59:16 -0400,
some guy <yoman@dude.com> wrote:
>
> I wrote a script for my website on tripod.com and half the time it works,
> but half the time it doesn't seem to like one of my regular expressions
> and generates the following error msg
>
> regexp reset interpolation flag trapped by operation mask at grades.cgi
> line 25
>
> The regular expression that it doesn't like looks like the following
>
> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
You probably have a slash (and maybe other metacharacters) in your
$thePassword variable. You should escape those. Look into the
quotemeta() function, or use the \Q and \E escape sequences. You also
should escape characters that don't need escaping. It makes your
expressions harder to read for no reason.
$entry =~ /[ \w]+::\Q$thePassword\E::/i
> Thanks for any help you can give. I am beginning to conclude that
> tripod.com has got a broken perl implementation. But I have learned to
> believe never blame it on the implementation.
Good idea.
See the perlfunc, perlre and possibly the perlop documentation for
more on quotemeta() and \Q. You might also want to read the
documentation for Safe. it might be that tripod uses that to run your
code.
Martien
--
|
Martien Verbruggen |
| Hi, Dave here, what's the root password?
|
------------------------------
Date: Mon, 14 Oct 2002 10:41:07 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Perl script works half the time
Message-Id: <slrnaqk4l3.q36.mgjv@martien.heliotrope.home>
On Sun, 13 Oct 2002 20:08:57 -0400,
some guy <yoman@dude.com> wrote:
> On Sun, 13 Oct 2002 21:01:07 -0400, Bob Walton wrote:
>
>> some guy wrote:
>>
>>> The regular expression that it doesn't like looks like the following
>>>
>>> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>>>
>> Does $thePassword come from the user? If so, it may contain regex
>> metacharacters. It would be possible to get various errors depending
>> upon the exact combination of characters used. Perhaps if you
>> quote-meta'ed them, maybe something like:
>>
>> $entry =~/[ \w]+::\Q$thePassword\E::/i;
> The $thePassword is controlled by me and will never contain characters
> which would otherwise need escaping. Is the tripod.com perl
> implementation just broken?
I doubt it.
Could you show us the contents of $thePassword when it fails?
Martien
--
|
Martien Verbruggen | Since light travels faster than sound, isn't
| that why some people appear bright until you
| hear them speak?
------------------------------
Date: 14 Oct 2002 01:00:02 GMT
From: Tina Mueller <usenet@tinita.de>
Subject: Re: Perl script works half the time
Message-Id: <aod4ui$l25o4$1@fu-berlin.de>
some guy <yoman@dude.com> wrote:
> On Sun, 13 Oct 2002 20:36:17 -0400, Tina Mueller wrote:
>> some guy <yoman@dude.com> wrote:
>>
>>> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>>
>> it looks like or it looks exactly like? consider $thePassword contains
>> ".*".
>> then this would *always* match.
>>
>> or
>> $string =~ m/\Q$regex\E/;
>>
> But I am controling the $thePassword variable and it never contains any
> characters that need to be escaped.
well, how are you controlling this?
tr/a-Za-z0-9//cd to allow only alphanumeric characters
would be a good start.
but anyway, adding \Q...\E doesn't harm.
just add it.
if it still fails, debug to see which content of $thePassword
breaks the regex.
hth, tina
--
http://www.tinita.de/ \ enter__| |__the___ _ _ ___
http://Movies.tinita.de/ \ / _` / _ \/ _ \ '_(_-< of
http://PerlQuotes.tinita.de/ \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Sun, 13 Oct 2002 21:02:16 -0400
From: some guy <yoman@dude.com>
Subject: Re: Perl script works half the time
Message-Id: <3daa173a$1_4@nopics.sjc>
On Sun, 13 Oct 2002 21:41:07 -0400, Martien Verbruggen wrote:
> On Sun, 13 Oct 2002 20:08:57 -0400,
> some guy <yoman@dude.com> wrote:
>> On Sun, 13 Oct 2002 21:01:07 -0400, Bob Walton wrote:
>>
>>> some guy wrote:
>>>
>>>
>>>> The regular expression that it doesn't like looks like the following
>>>>
>>>> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>>>>
>>> Does $thePassword come from the user? If so, it may contain regex
>>> metacharacters. It would be possible to get various errors depending
>>> upon the exact combination of characters used. Perhaps if you
>>> quote-meta'ed them, maybe something like:
>>>
>>> $entry =~/[ \w]+::\Q$thePassword\E::/i;
>
>> The $thePassword is controlled by me and will never contain characters
>> which would otherwise need escaping. Is the tripod.com perl
>> implementation just broken?
>
> I doubt it.
>
> Could you show us the contents of $thePassword when it fails?
>
> Martien
Sure, one of the passwords is "laga" for example(the quotes not included
of course). So what I do is I type in the password and click send and it
works. Then I hit the back button and click send again with the same
password in it, and it works. And I click the back button again and click
send, sending the same password, but this time it breaks giving the same
error msg
regexp reset interpolation flag trapped by operation mask at grades.cgi line
25
I can keep doing this and sometimes it works, and sometimes it breaks.
Even within the same password. I think the tripod.com perl implementation
is broken.
Thanks for your help.
------------------------------
Date: Sun, 13 Oct 2002 21:04:39 -0400
From: some guy <yoman@dude.com>
Subject: Re: Perl script works half the time
Message-Id: <3daa17ca_4@nopics.sjc>
On Sun, 13 Oct 2002 22:00:02 -0400, Tina Mueller wrote:
> some guy <yoman@dude.com> wrote:
>> On Sun, 13 Oct 2002 20:36:17 -0400, Tina Mueller wrote:
>>> some guy <yoman@dude.com> wrote:
>>>
>>>> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>>>
>>> it looks like or it looks exactly like? consider $thePassword contains
>>> ".*".
>>> then this would *always* match.
>>>
>>> or
>>> $string =~ m/\Q$regex\E/;
>>>
>> But I am controling the $thePassword variable and it never contains any
>> characters that need to be escaped.
>
> well, how are you controlling this?
> tr/a-Za-z0-9//cd to allow only alphanumeric characters would be a good
> start.
> but anyway, adding \Q...\E doesn't harm. just add it. if it still fails,
> debug to see which content of $thePassword breaks the regex.
>
> hth, tina
I am controling it by letting users only choose letters and numbers. If
they ask me for a password not of this type I tell them to choose
another.
Yeah I am gonna put in the \Q and \E after I read about them and see what
happens. Thanks.
------------------------------
Date: Sun, 13 Oct 2002 22:38:32 -0400
From: some guy <yoman@dude.com>
Subject: Re: Perl script works half the time
Message-Id: <3daa2dca$1_5@nopics.sjc>
On Sun, 13 Oct 2002 19:59:16 -0400, some guy wrote:
> Hi,
>
> I wrote a script for my website on tripod.com and half the time it
> works, but half the time it doesn't seem to like one of my regular
> expressions and generates the following error msg
>
> regexp reset interpolation flag trapped by operation mask at grades.cgi
> line 25
>
>
> The regular expression that it doesn't like looks like the following
>
> $entry =~ /[ \w]+\:\:$thePassword\:\:/i
>
> Thanks for any help you can give. I am beginning to conclude that
> tripod.com has got a broken perl implementation. But I have learned to
> believe never blame it on the implementation.
Well I put in the \Q and \E stuff and it is still doing the same thing.
so for the record right now my regular expression looks like
$entry =~ /[ \w]+::\Q$thePassword\E::/i
Does anyone think maybe the tripod.com perl implementation is broken?
Thanks.
------------------------------
Date: Sun, 13 Oct 2002 23:14:29 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: question from beginner >_<
Message-Id: <pkent77tea-CEFC28.00142914102002@news-text.blueyonder.co.uk>
In article <1751b2b5.0210121224.5eef7612@posting.google.com>,
manutd_kit@yahoo.com (kit) wrote:
> pkent <pkent77tea@yahoo.com.tea> wrote in message
> > Perl can probably do a lot, if not all, of what you want.
> Thanks for you help, I am currently working on a board game for my
> class, I 've already implemented it in c++, and I have to work on it
> in perl. I want to explore more on the networking part of the game,
> could you give me any suggestions?
> what about linux to linux , win to linux and win to win ??
a good cross platform graphics interface thingy is Tcl/Tk, although
there may be others I'm not so familiar with. You could also write
platform specific front-ends, which all hook into a generic game engine.
I guess that I personally might split the clients and the server
programs, so you have one server sitting somewhere that clients connect
to. You can do it all at the lowest level with raw sockets, but there
are various modules on CPAN that might help with a client/server model.
If you want to learn about network programming:
http://modperl.com:9000/perl_networking/
was a good source for me, also paid attention to cross-platform issues.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: 13 Oct 2002 17:09:14 -0700
From: kazchan@curio-city.com (kazchan)
Subject: Regular Expression (Referer)
Message-Id: <3baaab4f.0210131609.25650220@posting.google.com>
When I call my cgi script, I would like to control by referer. Ex: if
the referer is http://www.domain.com/dir1/dir2/dir3/, I would like to
display as dir3. I used (.*) to take off the part, but it look like
dir1 instead of dir3. Please someone tell me how to cut off the part
which I do not need. $ENV{HTTP_REFERER} =
http://www.domain.com/dir1/dir2/dir3/, but I do not need
http://www.domain.com/dir1/dir2// and need dir3.
Thank you in advance.
------------------------------
Date: 13 Oct 2002 23:27:01 GMT
From: Stephen Patterson <s.patterson@freeuk.com>
Subject: Re: Using Perl to solve interesting Banking Probm ..
Message-Id: <slrnaqk0rb.j2.s.patterson@seagoon.localdomain>
On Sun, 13 Oct 2002 20:16:50 GMT, Jay Tilton wrote:
> $x=0 x($n=500);
> $x=~s;(.{$_})(.);$1.($2^v1);egfor 0..$n-1;
> ++$i,print"$i "x$_ for$x=~/./g;
That must be right, it's unreadble :)
--
Stephen Patterson http://www.lexx.uklinux.net/ /"\
steve@SPAM.lexx.uklinux.net remove SPAM to reply \ /
Linux Counter No: 142831 GPG Public key: 252B8B37 X
ASCII Ribbon Campaign against HTML mail & news / \
------------------------------
Date: Mon, 14 Oct 2002 00:20:22 -0000
From: Warren Block <wblock@wonkity.com>
Subject: Re: Using Perl to solve interesting Banking Probm ..
Message-Id: <slrnaqk3jr.ih8.wblock@w0nkity.wonkity.com>
Jay Tilton <tiltonj@erols.com> wrote:
> Arrays and while loops are boring.
> Strings and for loops are where it's at, daddy-o.
>
> $x=0 x($n=500);
> $x=~s;(.{$_})(.);$1.($2^v1);egfor 0..$n-1;
> ++$i,print"$i "x$_ for$x=~/./g;
Do you have one of those that is at least as complex and undecipherable,
but just prints "Maybe you should do your own homework" when run?
I could see using that one a *lot*.
--
Warren Block * Rapid City, South Dakota * USA
------------------------------
Date: Mon, 14 Oct 2002 07:51:59 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: What purpose does eval{ ... } server?
Message-Id: <slrnaqjqnv.q36.mgjv@martien.heliotrope.home>
On Sun, 13 Oct 2002 14:00:40 -0700,
Tan Nguyen <nospam@nospam.com> wrote:
>
> "Paul Tomlinson" <me@hotmail.com> wrote in message
> news:aockab$l5osg$1@ID-116287.news.dfncis.de...
>> What purpose does eval{ ... } server?
> It's mainly used to catch exceptions from "die". To a much lesser extent, it
> also provides a convenient way of loading modules at runtime.
>
>> Nice and simple. And when should eval be used?
> It's a religious thing. Some might argue that eval is unsafe as people can
> maliciously fool "eval" into doing nasty things. As long as you understand
> what you're doing with "eval", you should be fine. Barring "eval" from your
> code altogether might keep you from having interesting, nice and elegant
> code constructs.
You should probably make it clear that you are talking about two
different pieces of functionality here. eval BLOCK is used to catch
exceptions, and is safe. eval EXPR can be problematic if you feed it
external input. The OP should probably also be referred to the
appropriate documentation, where the difference between the two forms of
eval is explained.
And I wouldn't call it a "religious thing". People use eval BLOCK when
they need to trap runtime exceptions, and they use eval EXPR when they
need to compile and execute code at runtime (and there is no other way
to do it). Nobody uses eval religiously, AFAIK. Very few people would
object to eval religiously, once they understand it. Many people try to
avoid eval EXPR by choosing an implementation that avoids it, but that's
just common sense, not religion.
$ perldoc -f eval
Martien
--
|
Martien Verbruggen | The problem with sharks is that they are too
| large to get to the shallow end of the gene
| pool. -- Scott R. Godin
------------------------------
Date: Sun, 13 Oct 2002 17:25:52 -0700
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: What purpose does eval{ ... } server?
Message-Id: <3daa0e85$1_5@nopics.sjc>
"Steve Grazzini" <s_grazzini@hotmail.com> wrote in message
news:3da9e831@news.mhogaming.com...
> Tan Nguyen <nospam@nospam.com> wrote:
> > "Paul Tomlinson" <me@hotmail.com> wrote:
> >> What purpose does eval{ ... } server?
>
> > It's mainly used to catch exceptions from "die". To a much lesser
> > extent, it also provides a convenient way of loading modules at
> > runtime.
>
> Sounds like you started thinking of string eval in the
> middle of your answer.
Corrent. Should've been more careful with what I wrote.
> >> Nice and simple. And when should eval be used?
> > It's a religious thing. Some might argue that eval is unsafe as
> > people can maliciously fool "eval" into doing nasty things. As
> > long as you understand what you're doing with "eval", you should
> > be fine. Barring "eval" from your code altogether might keep you
> > from having interesting, nice and elegant code constructs.
>
> 'eval BLOCK' *only* traps errors. It doesn't delay
> compilation and it doesn't pose any of the security
> risks of string eval.
>
> Both forms are described in:
>
> $ perldoc -f eval
>
> --
> Steve
>
> perldoc -qa.j | perl -lpe '($_)=m("(.*)")'
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 3964
***************************************