On Wed, Apr 10, 2002 at 11:03:27AM +0100, Mark Fowler wrote: > On Tue, 9 Apr 2002, Adrian Howard wrote: > > > Any comments before I throw it at CPAN? Sound vaguely sane? > > throws_ok can take either a class name or a Regexp ref as an argument to > compare against. With earlier versions of perl you can't use the qr// > operator, so you can't pass regex. Maybe it would be possible to take a > leaf out of Test::Builder's book for this: > > # Check if it looks like '/foo/' > elsif( my($re, $opts) = $regex =~ m{^ /(.*)/ (\w*) $ }sx ) { > $usable_regex = "(?$opts)$re"; > }
You could even tear that out of Test::Builder->like and into it's own Test::Builder->may_be_regex method so you don't have to duplicate code. -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Hey you kids, come back here! I know who your parents are! You wouldn't do this if Nixon was in the White House! Come on, I'm the Walrus, damnit!