Steve Bertrand wrote: > However, I needed to take two seconds to at least state that my claim, > that the second param into Test::More "is forced into qr//" was > unfounded and unjustified. > > I don't know if that is what happens
For completeness (and as a code tracking exercise for myself), I found
out about the odd use regarding qr//.
In Test::Builder.pm I found my way to this sub, where I got pretty well
all I needed to know (aside from the documentation).
sub maybe_regex {
my ($self, $regex) = @_; my $usable_regex = undef;
return $usable_regex unless defined $regex;
my($re, $opts);
# Check for qr/foo/
if( _is_qr($regex) ) {
$usable_regex = $regex;
}
# Check for '/foo/' or 'm,foo,'
elsif( ($re, $opts) = $regex =~ m{^ /(.*)/ (\w*) $ }sx
...and:
You'll want to avoid qr// if you want your tests to work before 5.005.
So apparently prior to 5.005, qr wouldn't work/didn't exist or what have
you, so this program bridges that gap by leaving in the old style code,
but also allowing the user to use qr// if they desire.
Given that in the "Check for '/foo/' code above, it slurps everything
between '/ and /'. So, now I know why $_ inside of the single-quotes was
being interpolated when in a normal situation it would not.
Steve
smime.p7s
Description: S/MIME Cryptographic Signature
