The Morsbergers wrote on 01.6.18 10:32 PM: 
>I changed line 85 in URI.pm from
>
>   if (!$scheme || $scheme !~ /\A$scheme_re\z/o) {
>
>to
>
>   if (!$scheme || $scheme !~ /\A$scheme_re\Z/o) {
>
>Out of curiosity, why was \A and \Z used instead of ^ and $?

I had the same problem on MacPerl which is based on 5.004

Gisle answered:
--------------------------
Subject: Re: URI on MacPerl
Date: Tue, 8 May 2001 07:12:12 -0700
From: Gisle Aas <[EMAIL PROTECTED]>
Sender: [EMAIL PROTECTED]
To: KIMURA Takeshi <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.5

KIMURA Takeshi <[EMAIL PROTECTED]> writes:

> I found that for MacPerl \z does not work as a regular expression.
> 
> Can it be changed to \Z ?

In most cases that would not hurt.  The difference between them is
that \Z (like $) will also match if there is a "\n" just before 
the
end, and I don't really want to allow a scheme like "http\n"

What perl version is MacPerl based on?

\z seems to have been introduced with perl-5.005.  The URI README 
(and
Makefile.PL) should probably stop claiming that perl5.004 is 
enough.

> Would it work as expeted if I change on line 85 of URI.pm (URI-1.
> 12)
> 
>    if (!$scheme || $scheme !~ /\A$scheme_re\z/o) {
> 
> to
> 
>    if (!$scheme || $scheme !~ /\A$scheme_re\Z/o) {

It works as long as $scheme does not end with "\n".  You could 
change
it into something like this to be safe:

   if (!$scheme || ($scheme !~ /\A$scheme_re\Z/o && $scheme !~ /\
n\Z/)) {

Regards,
Gisle
--------------------------


--
Takeshi

Reply via email to