develooper Front page | perl.perl5.porters | Postings from January 2009

Re: perldelta omission for 5.8.9?

Thread Previous | Thread Next
January 28, 2009 13:46
Re: perldelta omission for 5.8.9?
Message ID:
Citeren Ricardo SIGNES <>:

> I forgot about how dramatically more useful qr{} became once qr{}m worked
> properly, as demonstrated by this code:
>   use strict;
>   use Test::More 'no_plan';
>   my $string = "Subject: Hello Jimbo Johnson\x0ADate: whatever";
>   like($string, '/(?m:^Subject: Hello Jimbo Johnson$)/', "q{//}",);
>   like($string, qr{(?m:^Subject: Hello Jimbo Johnson$)}, "qr{(?m:...)}",);
>   like($string, qr{^Subject: Hello Jimbo Johnson$}m,     "qr{}m",);
> This was fixed in 5.010, but it looks like the fix made it back into 5.8.9
> (which is great!) but was not documented, going by

I hope it isn't fixed in 5.8.9 since it is not backwards compatible.  
(As in, it behaves differently.)

> Am I mistaken, or is this an omission to fix in some mythical 5.8.10?

There does seem to be a different in behaviour between 5.8.8 and 5.8.9  
but note that it does not behave the same as 5.10.0.

The following prints "not ok" on 5.8.8/5.8.9 and "ok" on 5.10.0 (the  
behaviour in 5.10.0 is the 'correct' one):

   my $string = "Subject: Hello Jimbo Johnson\x0ADate: whatever";
   my $re = qr{^Subject: Hello Jimbo Johnson$};  # no /m
   print $string !~ /$re/m ? "ok" : "not ok"; # shouldn't match since  
$re didn't had /m

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About