[17693] in Perl-Users-Digest
Perl-Users Digest, Issue: 5113 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 14 14:15:43 2000
Date: Thu, 14 Dec 2000 11:15:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976821320-v9-i5113@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 14 Dec 2000 Volume: 9 Number: 5113
Today's topics:
Re: Regex can't be greedy with /(a|ab)/ ? (Rafael Garcia-Suarez)
Re: Regex can't be greedy with /(a|ab)/ ? <uri@sysarch.com>
Re: Regex can't be greedy with /(a|ab)/ ? (Abigail)
Re: Regex can't be greedy with /(a|ab)/ ? (Abigail)
Re: Regex can't be greedy with /(a|ab)/ ? (Tom Christiansen)
Re: Regex can't be greedy with /(a|ab)/ ? (Tom Christiansen)
Re: Regex can't be greedy with /(a|ab)/ ? (Rafael Garcia-Suarez)
Re: Regex can't be greedy with /(a|ab)/ ? <ts@doc.ic.ac.uk>
Removing Whitespace Question <jsoliven@cse.buffalo.edu>
Re: Removing Whitespace Question (Richard Zilavec)
Re: Sending ; though a form. <basskiwi@my-deja.com>
Re: Sending ; though a form. <jeffp@crusoe.net>
Re: Sending ; though a form. <mbudash@sonic.net>
Re: Sending ; though a form. nobull@mail.com
Re: Setting timeout with IO::Socket (Dave Sherohman)
Re: Setting timeout with IO::Socket <cbah@chez.com>
Re: using perl to call external libraries nobull@mail.com
Re: What is Perl anyway? <kcount@ardenhouse.com>
What is the .packlist file <harrisr@bignet.net>
Re: Win32::ODBC/MSAccess query <rayers@answerlogic.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 14 Dec 2000 16:18:55 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <slrn93hsnq.1l8.rgarciasuarez@rafael.kazibao.net>
Uri Guttman wrote in comp.lang.perl.misc:
> >>>>> "PS" == Patrick Stein <thisisnotanemailaddress@dtag.de> writes:
>
> PS> Is there a way to get | in regexes greedy ( matching the most possible
> PS> characters )
>
> PS> $string =~ /(a|ab)/;
>
> change the order to (ab|a). alternation works left to right and always
> returns the first legal match.
I think that the OP wants a way to handle this with generated regexps,
as with:
my $r = join '|', @searched_words;
$string =~ /($r)/;
My suggestion would be to sort @searched_words by string length,
descending.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 14 Dec 2000 16:27:14 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <x7itonhst8.fsf@home.sysarch.com>
>>>>> "RG" == Rafael Garcia-Suarez <rgarciasuarez@free.fr> writes:
RG> Uri Guttman wrote in comp.lang.perl.misc:
>> >>>>> "PS" == Patrick Stein <thisisnotanemailaddress@dtag.de> writes:
>>
PS> Is there a way to get | in regexes greedy ( matching the most possible
PS> characters )
RG> I think that the OP wants a way to handle this with generated regexps,
RG> as with:
RG> my $r = join '|', @searched_words;
RG> $string =~ /($r)/;
RG> My suggestion would be to sort @searched_words by string length,
RG> descending.
sounds correct. he wasn't clear so i had to assume a fixed set of tokens
to match.
and for the OP, the sort code is
@sorted_tokens = sort {length($b) <=> length($a)} @tokens ;
note the descending order!
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 14 Dec 2000 16:35:55 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <slrn93htnb.elk.abigail@tsathoggua.rlyeh.net>
On Thu, 14 Dec 2000 15:36:36 GMT, Uri Guttman (uri@sysarch.com) wrote in comp.lang.perl.misc <URL: news:<x7puivhv5p.fsf@home.sysarch.com>>:
++ >>>>> "PS" == Patrick Stein <thisisnotanemailaddress@dtag.de> writes:
++
++ PS> Is there a way to get | in regexes greedy ( matching the most possible
++ PS> characters )
++
++ PS> $string =~ /(a|ab)/;
++
++ change the order to (ab|a). alternation works left to right and always
++ returns the first legal match.
/ab?/
should be more efficient, as it doesn't have to match 'a' twice when
it's not followed by a b.
Abigail
------------------------------
Date: 14 Dec 2000 16:43:37 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <slrn93hu5p.elk.abigail@tsathoggua.rlyeh.net>
On Thu, 14 Dec 2000 16:18:55 GMT, Rafael Garcia-Suarez (rgarciasuarez@free.fr) wrote in comp.lang.perl.misc <URL: news:<slrn93hsnq.1l8.rgarciasuarez@rafael.kazibao.net>>:
++ Uri Guttman wrote in comp.lang.perl.misc:
++ > >>>>> "PS" == Patrick Stein <thisisnotanemailaddress@dtag.de> writes:
++ >
++ > PS> Is there a way to get | in regexes greedy ( matching the most possible
++ > PS> characters )
++ >
++ > PS> $string =~ /(a|ab)/;
++ >
++ > change the order to (ab|a). alternation works left to right and always
++ > returns the first legal match.
++
++ I think that the OP wants a way to handle this with generated regexps,
++ as with:
++ my $r = join '|', @searched_words;
++ $string =~ /($r)/;
++
++ My suggestion would be to sort @searched_words by string length,
++ descending.
That won't do.
length ('a*') < length ('aaa')
for instance.
But it's worse. If you have 'a*' and 'b*', it depends on the to be matched
string whether /a*|b*/ or /b*|a*/ will result in the longest match.
Abigail
------------------------------
Date: 14 Dec 2000 09:49:07 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <3a38fa03@cs.colorado.edu>
In article <91ao42$vag$00$1@news.t-online.com>,
Patrick Stein <thisisnotanemailaddress@dtag.de> wrote:
>I searched the FAQ, but couldn't find anything so someone here might know:
>
>Is there a way to get | in regexes greedy ( matching the most possible
>characters )
From Camel:
At any given position, the Engine tries to match the first
alternative, and then the second, and so on. The relative length of
the alternatives does not matter, which means that in this pattern:
/(Sam|Samwise)/
C<$1> will never be set to C<Samwise> no matter what string it's
matched against, because C<Sam> will always match first. When you
have overlapping matches like this, put the longer ones at the
beginning.
>$string =~ /(a|ab)/;
>How can I match 'ab' without first sorting ? This regex will never match 'ab'
>and that's where the perl interpreter should complain.
Patches welcome.
>Sorting might help, but I think that perl might have a better way of finding
"might"?
>'ab' ( especially if the strings you are looking for are coming from arrays )
>and the perl interpreter builds the matching trie or tree anyways.
The ability to specify a user-defined precedence order on alteratives
is more powerful than not being able to specify such an order. It
means that you can choose between something like this:
print "1 MATCHED: $`<$&>$'\n" while "crabcatcher" =~ /a|ab|abc/g;
1 MATCHED: cr<a>bcatcher
1 MATCHED: crabc<a>tcher
And something like this:
print "2 MATCHED: $`<$&>$'\n" while "crabcatcher" =~ /abc|ab|a/g;
2 MATCHED: cr<abc>atcher
2 MATCHED: crabc<a>tcher
If you were not able to specify the order, but had to accept whatever
was given to you, than this would diminish expresssive power.
That said, the Engine is not particularly clever, as "use re debug"
reveals:
Compiling REx `a|ab|abc'
size 10
1: BRANCH(4)
2: EXACT <a>(10)
4: BRANCH(7)
5: EXACT <ab>(10)
7: BRANCH(10)
8: EXACT <abc>(10)
10: END(0)
minlen 1
Compiling REx `abc|ab|a'
size 10
1: BRANCH(4)
2: EXACT <abc>(10)
4: BRANCH(7)
5: EXACT <ab>(10)
7: BRANCH(10)
8: EXACT <a>(10)
10: END(0)
minlen 1
Matching REx `a|ab|abc' against `crabcatcher'
Setting an EVAL scope, savestack=6
0 <> <crabcatcher> | 1: BRANCH
Setting an EVAL scope, savestack=6
0 <> <crabcatcher> | 2: EXACT <a>
failed...
0 <> <crabcatcher> | 5: EXACT <ab>
failed...
0 <> <crabcatcher> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=6
1 <c> <rabcatcher> | 1: BRANCH
Setting an EVAL scope, savestack=6
1 <c> <rabcatcher> | 2: EXACT <a>
failed...
1 <c> <rabcatcher> | 5: EXACT <ab>
failed...
1 <c> <rabcatcher> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=6
2 <cr> <abcatcher> | 1: BRANCH
Setting an EVAL scope, savestack=6
2 <cr> <abcatcher> | 2: EXACT <a>
3 <cra> <bcatcher> | 10: END
Match successful!
1 MATCHED: cr<a>bcatcher
Matching REx `a|ab|abc' against `bcatcher'
Setting an EVAL scope, savestack=3
3 <cra> <bcatcher> | 1: BRANCH
Setting an EVAL scope, savestack=3
3 <cra> <bcatcher> | 2: EXACT <a>
failed...
3 <cra> <bcatcher> | 5: EXACT <ab>
failed...
3 <cra> <bcatcher> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=3
4 <crab> <catcher> | 1: BRANCH
Setting an EVAL scope, savestack=3
4 <crab> <catcher> | 2: EXACT <a>
failed...
4 <crab> <catcher> | 5: EXACT <ab>
failed...
4 <crab> <catcher> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=3
5 <crabc> <atcher> | 1: BRANCH
Setting an EVAL scope, savestack=3
5 <crabc> <atcher> | 2: EXACT <a>
6 <crabca> <tcher> | 10: END
Match successful!
1 MATCHED: crabc<a>tcher
Matching REx `a|ab|abc' against `tcher'
Setting an EVAL scope, savestack=3
6 <crabca> <tcher> | 1: BRANCH
Setting an EVAL scope, savestack=3
6 <crabca> <tcher> | 2: EXACT <a>
failed...
6 <crabca> <tcher> | 5: EXACT <ab>
failed...
6 <crabca> <tcher> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=3
7 <crabcat> <cher> | 1: BRANCH
Setting an EVAL scope, savestack=3
7 <crabcat> <cher> | 2: EXACT <a>
failed...
7 <crabcat> <cher> | 5: EXACT <ab>
failed...
7 <crabcat> <cher> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=3
8 <crabcatc> <her> | 1: BRANCH
Setting an EVAL scope, savestack=3
8 <crabcatc> <her> | 2: EXACT <a>
failed...
8 <crabcatc> <her> | 5: EXACT <ab>
failed...
8 <crabcatc> <her> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=3
9 <crabcatch> <er> | 1: BRANCH
Setting an EVAL scope, savestack=3
9 <crabcatch> <er> | 2: EXACT <a>
failed...
9 <crabcatch> <er> | 5: EXACT <ab>
failed...
9 <crabcatch> <er> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=3
10 <crabcatche> <r> | 1: BRANCH
Setting an EVAL scope, savestack=3
10 <crabcatche> <r> | 2: EXACT <a>
failed...
10 <crabcatche> <r> | 5: EXACT <ab>
failed...
10 <crabcatche> <r> | 8: EXACT <abc>
failed...
failed...
Setting an EVAL scope, savestack=3
11 <crabcatcher> <> | 1: BRANCH
Setting an EVAL scope, savestack=3
11 <crabcatcher> <> | 2: EXACT <a>
failed...
11 <crabcatcher> <> | 5: EXACT <ab>
failed...
11 <crabcatcher> <> | 8: EXACT <abc>
failed...
failed...
Matching REx `abc|ab|a' against `crabcatcher'
Setting an EVAL scope, savestack=6
0 <> <crabcatcher> | 1: BRANCH
Setting an EVAL scope, savestack=6
0 <> <crabcatcher> | 2: EXACT <abc>
failed...
0 <> <crabcatcher> | 5: EXACT <ab>
failed...
0 <> <crabcatcher> | 8: EXACT <a>
failed...
failed...
Setting an EVAL scope, savestack=6
1 <c> <rabcatcher> | 1: BRANCH
Setting an EVAL scope, savestack=6
1 <c> <rabcatcher> | 2: EXACT <abc>
failed...
1 <c> <rabcatcher> | 5: EXACT <ab>
failed...
1 <c> <rabcatcher> | 8: EXACT <a>
failed...
failed...
Setting an EVAL scope, savestack=6
2 <cr> <abcatcher> | 1: BRANCH
Setting an EVAL scope, savestack=6
2 <cr> <abcatcher> | 2: EXACT <abc>
5 <crabc> <atcher> | 10: END
Match successful!
2 MATCHED: cr<abc>atcher
Matching REx `abc|ab|a' against `atcher'
Setting an EVAL scope, savestack=3
5 <crabc> <atcher> | 1: BRANCH
Setting an EVAL scope, savestack=3
5 <crabc> <atcher> | 2: EXACT <abc>
failed...
5 <crabc> <atcher> | 5: EXACT <ab>
failed...
5 <crabc> <atcher> | 8: EXACT <a>
6 <crabca> <tcher> | 10: END
Match successful!
2 MATCHED: crabc<a>tcher
Matching REx `abc|ab|a' against `tcher'
Setting an EVAL scope, savestack=3
6 <crabca> <tcher> | 1: BRANCH
Setting an EVAL scope, savestack=3
6 <crabca> <tcher> | 2: EXACT <abc>
failed...
6 <crabca> <tcher> | 5: EXACT <ab>
failed...
6 <crabca> <tcher> | 8: EXACT <a>
failed...
failed...
Setting an EVAL scope, savestack=3
7 <crabcat> <cher> | 1: BRANCH
Setting an EVAL scope, savestack=3
7 <crabcat> <cher> | 2: EXACT <abc>
failed...
7 <crabcat> <cher> | 5: EXACT <ab>
failed...
7 <crabcat> <cher> | 8: EXACT <a>
failed...
failed...
Setting an EVAL scope, savestack=3
8 <crabcatc> <her> | 1: BRANCH
Setting an EVAL scope, savestack=3
8 <crabcatc> <her> | 2: EXACT <abc>
failed...
8 <crabcatc> <her> | 5: EXACT <ab>
failed...
8 <crabcatc> <her> | 8: EXACT <a>
failed...
failed...
Setting an EVAL scope, savestack=3
9 <crabcatch> <er> | 1: BRANCH
Setting an EVAL scope, savestack=3
9 <crabcatch> <er> | 2: EXACT <abc>
failed...
9 <crabcatch> <er> | 5: EXACT <ab>
failed...
9 <crabcatch> <er> | 8: EXACT <a>
failed...
failed...
Setting an EVAL scope, savestack=3
10 <crabcatche> <r> | 1: BRANCH
Setting an EVAL scope, savestack=3
10 <crabcatche> <r> | 2: EXACT <abc>
failed...
10 <crabcatche> <r> | 5: EXACT <ab>
failed...
10 <crabcatche> <r> | 8: EXACT <a>
failed...
failed...
Setting an EVAL scope, savestack=3
11 <crabcatcher> <> | 1: BRANCH
Setting an EVAL scope, savestack=3
11 <crabcatcher> <> | 2: EXACT <abc>
failed...
11 <crabcatcher> <> | 5: EXACT <ab>
failed...
11 <crabcatcher> <> | 8: EXACT <a>
failed...
failed...
Freeing REx: `a|ab|abc'
Freeing REx: `abc|ab|a'
Perhaps some work could be done here so it doesn't keep trying the
same thing when it knows it can't be there, and this might make
something that could produce your warnings. Then again, you will
surely cause a million people to bitch about previously nongrinching
programs carping up a storm.
--tom
------------------------------
Date: 14 Dec 2000 10:05:48 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <3a38fdec$1@cs.colorado.edu>
In article <slrn93hu5p.elk.abigail@tsathoggua.rlyeh.net>,
Abigail <abigail@foad.org> wrote:
>That won't do.
> length ('a*') < length ('aaa')
>for instance.
>
>But it's worse. If you have 'a*' and 'b*', it depends on the to be matched
>string whether /a*|b*/ or /b*|a*/ will result in the longest match.
Quite. Enforcing a DFA-style behavior here leads to the miserable,
guaranteed worst-case behavior of POSIX NFAs, in which all alternatives
must be tested before a decision based on varying length can even
start to be applied.
People are, for some reason, only thinking about constant strings
without any special characters in them. Even so, I'd thought that
the Engine optimized such multiway fgrep-style matches, but as my
other posting seems to indicate, I seem to have thought wrong.
In such simple cases, the guaranteed worst-case behavior might not
be so traumatic:
% echo crabcatcher | awk 'match($0,/a|ab|abc/) {
print substr($0, RSTART, RLENGTH)
}'
abc
% echo crabcatcher | perl -lne '/a|ab|abc/ && print $&'
a
But in more complicated cases, it could prove prohibitively
time-consuming. Furthermore, the consequent results are not
necessarily always immediately intuitive to non-regex-initiates:
% echo crabcatcher | awk 'match($0,/a|ab|abc/) {
print substr($0, RSTART, RLENGTH),
"at", RSTART
}'
abc at 3
% echo crabcatcher | awk 'match($0,/a*|a*b*|a*b*c*/) {
print substr($0, RSTART, RLENGTH),
"at", RSTART
}'
c at 1
--tom
------------------------------
Date: Thu, 14 Dec 2000 17:15:59 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <slrn93i02q.1qs.rgarciasuarez@rafael.kazibao.net>
Abigail wrote in comp.lang.perl.misc:
> On Thu, 14 Dec 2000 16:18:55 GMT, Rafael Garcia-Suarez (rgarciasuarez@free.fr) wrote in comp.lang.perl.misc <URL: news:<slrn93hsnq.1l8.rgarciasuarez@rafael.kazibao.net>>:
> ++
> ++ I think that the OP wants a way to handle this with generated regexps,
> ++ as with:
> ++ my $r = join '|', @searched_words;
> ++ $string =~ /($r)/;
> ++
> ++ My suggestion would be to sort @searched_words by string length,
> ++ descending.
>
>
> That won't do.
>
> length ('a*') < length ('aaa')
>
> for instance.
Guessing what the OP real problem is, I imagined he used words,
eventually meta-quoted. Otherwise I'd have written
my $r = join '|', map "($_)", @searched_patterns;
which is, as you pointed out, obviously buggy.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 14 Dec 2000 15:31:18 +0000
From: "Tim Southerwood" <ts@doc.ic.ac.uk>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <91ap46$jq9$1@lux.doc.ic.ac.uk>
In article <91ao42$vag$00$1@news.t-online.com>, "Patrick Stein"
<thisisnotanemailaddress@dtag.de> wrote:
>
<snip>
> Is there a way to get | in regexes greedy ( matching the most possible
> characters )
>
> $string =~ /(a|ab)/;
>
> How can I match 'ab' without first sorting ? This regex will never match
> 'ab' and that's where the perl interpreter should complain. Sorting
> might help, but I think that perl might have a better way of finding
> 'ab' ( especially if the strings you are looking for are coming from
> arrays )
How about:
$string =~ /(ab?)/;
Or was this a more general question specifically about "|" in regexes?
I don't know how perl regexes action "|" but in in core perl logic:
if ($a || $b) ...
will never evaluate $b is $a is TRUE.
Maybe the same philosphy applies?..
Cheers
Tim
--
Mr Tim J Southerwood
CSG, Dept of Computing, Imperial College, London
Tel: +44 (0)20 7594 8392
Email@Work: ts@doc.ic.ac.uk Email@Home: ts@dionic.co.uk
------------------------------
Date: Thu, 14 Dec 2000 11:47:47 -0500
From: Evil Jim <jsoliven@cse.buffalo.edu>
Subject: Removing Whitespace Question
Message-Id: <Pine.GSO.3.96.1001214114353.14497A-100000@armstrong.cse.Buffalo.EDU>
Hi,
I'm trying to remove whitespace from a string but I have no idea how to do
it. Basically, if we have a string
$a = "blah-blahXXXXXXXXX"; (Where X is a whitespace character)
I want to chop it down to just $a = "blah-blah"; Anyone know of any
pattern translation for this? I appreciate any help anyone can offer.
/jim
------------------------------
Date: Thu, 14 Dec 2000 17:02:40 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Removing Whitespace Question
Message-Id: <3a38fcf8.168757574@news.tcn.net>
On Thu, 14 Dec 2000 11:47:47 -0500, Evil Jim
<jsoliven@cse.buffalo.edu> wrote:
>Hi,
>
>I'm trying to remove whitespace from a string but I have no idea how to do
>it. Basically, if we have a string
>
> $a = "blah-blahXXXXXXXXX"; (Where X is a whitespace character)
>
>I want to chop it down to just $a = "blah-blah"; Anyone know of any
>pattern translation for this? I appreciate any help anyone can offer.
$a =~ s/\s+$//;
Seems to be the never ending topic.....
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Thu, 14 Dec 2000 15:59:11 GMT
From: Basskiwi <basskiwi@my-deja.com>
Subject: Re: Sending ; though a form.
Message-Id: <91aqo9$tqf$1@nnrp1.deja.com>
It seems the browser is for some reason is not encoding the ; as %3B.
Why would this be?
In article <91a3am$bfr$1@nnrp1.deja.com>,
deja@basskiwi.org wrote:
> I am trying to send a ; though a form, but when it comes to printing
out
> the string containing the ; it gets truncated (abc;def prints as abc).
> The script only seems to do this when the print $variable is included
in
> a sub and not when it is in the main body.
>
> Anyone any ideas?
>
> Cheers.
>
> Sent via Deja.com
> http://www.deja.com/
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 14 Dec 2000 11:34:15 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Sending ; though a form.
Message-Id: <Pine.GSO.4.21.0012141133410.4213-100000@crusoe.crusoe.net>
[posted & mailed]
On Dec 14, Basskiwi said:
>It seems the browser is for some reason is not encoding the ; as %3B.
>Why would this be?
Because the SGML specs say that ; and & can both be used in the query
string to separate key=value pairs.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Thu, 14 Dec 2000 10:03:17 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Sending ; though a form.
Message-Id: <mbudash-31C78A.10031714122000@news.pacbell.net>
In article <Pine.GSO.4.21.0012141133410.4213-100000@crusoe.crusoe.net>,
japhy@pobox.com wrote:
> [posted & mailed]
>
> On Dec 14, Basskiwi said:
>
> >It seems the browser is for some reason is not encoding the ; as %3B.
> >Why would this be?
>
> Because the SGML specs say that ; and & can both be used in the query
> string to separate key=value pairs.
then why wouldn't the browser (which most likely has been written
'aware' of the sgml spec) encode either of them when they appear in the
'value' portion of a name/value pair?
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 14 Dec 2000 18:06:37 +0000
From: nobull@mail.com
Subject: Re: Sending ; though a form.
Message-Id: <u9k8926fo2.fsf@wcl-l.bham.ac.uk>
Basskiwi <basskiwi@my-deja.com> writes:
> I am trying to send a ; though a form, but when it comes to printing out
> the string containing the ; it gets truncated (abc;def prints as abc).
> The script only seems to do this when the print $variable is included in
> a sub and not when it is in the main body.
This is a recording....
Please produce a minimal strict, warning-free, script that reproduces
the problem you describe an post it here verbatim.
You have not been charged for this call.
[whirr... click]
Please produce a minimal strict, warning-free, script that reproduces
the problem you describe an post it here verbatim.
You have not been charged for this call.
[whirr... click]
Please produce a minimal strict, warning-free, script that reproduces
the problem you describe an post it here verbatim.
You have not been charged for this call.
[whirr... click, click]
Please hang up and try again...
Please hang up and try again...
Please hang up and try again...
Please hang up and try again...
[whirr... CLICK! Beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee... ]
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 14 Dec 2000 17:46:26 GMT
From: esper@news.visi.com (Dave Sherohman)
Subject: Re: Setting timeout with IO::Socket
Message-Id: <slrn93i1ri.i0u.esper@pchan.sherohman.org>
On Wed, 13 Dec 2000 23:29:51 GMT, Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
> but you could wrap the recv in an eval (perldoc perlipc for
> details):
Thanks! With a couple trivial modifications, your sample code on how to do
this worked perfectly.
--
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1: GCS d? s+: a- C++ UL++$ P++>+++ L+++>++++ E- W--(++) N+ o+
!K w---$ O M- V? PS+ PE Y+ PGP t 5++ X+ R++ tv b+ DI++++ D G e* h+ r y+
------------------------------
Date: Thu, 14 Dec 2000 14:03:10 -0500
From: "Vladimir Silyaev" <cbah@chez.com>
Subject: Re: Setting timeout with IO::Socket
Message-Id: <91b5fq$6tu$1@slb3.atl.mindspring.net>
"Dave Sherohman" <esper@news.visi.com> wrote in message
news:slrn93csqu.kof.esper@pchan.sherohman.org...
> (I asked this question in comp.lang.perl.modules yesterday, but have yet
to
> get any responses, so I'm bringing it over to .misc. I'd rather have just
> left it in .modules, but that group doesn't seem to be very active...)
[skiipped]
> Anyhow, I figure the best way to handle this sweep for orphaned requests
is
> to slap a timeout on my recv call so that it will be performed whenever X
> minutes pass without any activity. All the examples I've been able to
turn
> up on the web essentially boil down to 'die on timeout' (which is not
> appropriate here) implemented using SIGALRM. I don't think a signal
handler
> is the correct approach here - sweeping through a hash of hashes (hash of
> requests with a hash of request details for each) and examining them all
> takes longer than I'm comfortable with in a signal handler. Plus, some
'old'
> entries will be deleted on the assumption that they were orphaned by UDP
> delivery failures instead of server failure; modifying data in signal
> handlers is generally considered to be a Bad Thing as well.
>
> The obvious solution,
>
> ---
> my $socket = IO::Socket::INET->new( LocalPort => $port,
> Proto => 'udp',
> Timeout => 1
> );
>
> while (1) {
> my $sender = $socket->recv(my $datagram, 8192);
> print "Recv completed.\n";
> }
You have to consider to use select call to implement timeout functionality,
just call select with required timeout before
to call recv.
--
Vladimir Silyaev
Brainbench MVP for Perl
http://www.brainbench.com
------------------------------
Date: 14 Dec 2000 18:11:32 +0000
From: nobull@mail.com
Subject: Re: using perl to call external libraries
Message-Id: <u9itom6ffv.fsf@wcl-l.bham.ac.uk>
Mark <mark_lybarger@yahoo.com> writes:
> Does anyone know if it's possible to call a C++ library using Perl?
Has "anyone" looked in the Perl documentation?
If so then yes, "anyone" knows.
perldoc perlxs/"Using XS With C++"
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 14 Dec 2000 13:17:29 -0500
From: "kcount" <kcount@ardenhouse.com>
Subject: Re: What is Perl anyway?
Message-Id: <91b2m4$tle$1@news.warwick.net>
"Which machines use perl" - There are versions of Perl for pretty much every
major operating system going.
"and why should I use it?" - You should use it cause it makes easy things
easy and hard things possible. Plus it's the coolest language going.
"Is it for websites too?" - Depends what you mean by "for". If you mean for
processing data dynamically from a webpage form, nothing compares. Perl is
king. So, yes, it's "for" websites too.
Kip
#!/usr/bin/perl || die;
------------------------------
Date: Thu, 14 Dec 2000 13:04:54 -0500
From: "Randy Harris" <harrisr@bignet.net>
Subject: What is the .packlist file
Message-Id: <t3i2t2ko8f2586@corp.supernews.com>
My ActiveState Perl installation has a number of files named .packlist
scattered through it. Anyone know how Perl uses these files? I'm
hoping that they are for installation only and aren't needed afterward.
Randy Harris
------------------------------
Date: Thu, 14 Dec 2000 11:49:07 -0500
From: "Robert L. Ayers" <rayers@answerlogic.com>
Subject: Re: Win32::ODBC/MSAccess query
Message-Id: <3W6_5.14$wT3.229@client>
Yes it is possible to call an existing query in an MSAccess database from
Perl. To do this, you don't even need Win32::ODBC, if you are using
Win32::OLE. It is fairly easy to use OLE to create some ADO objects that
can be used to handle most database needs.
Robert L. Ayers
<rysmiel@my-deja.com> wrote in message news:90ocg3$ie8$1@nnrp1.deja.com...
> Is it possible to call an existing queryin an MSAccess database from a
> perl script using Win32::ODBC, and if so what is the format ?
>
> Thanks in advance,
>
> E
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 5113
**************************************