On 2001.06.19 04:32:28 +0200 The Morsbergers wrote:
> I was unable to install and test the URI module v1.12 on a Compaq Tru64
> host, Perl version 5.004_04.
>
> The data and mailto tests were failing.
>
> 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 $?
\z (lowercase) was introduced in perl 5.005. It matches at the actual end
of the string, not ignoring an optional trailing newline. This test ensures
that the $scheme does not end with a \n.
Using perl 5.6.1 :
$ perl -le 'print "abc\n" =~ /\Aabc\z/ ? 1:0'
0
$ perl -le 'print "abc\n" =~ /\Aabc\Z/ ? 1:0'
1
--
Rafael Garcia-Suarez