Skip to content

Commit

Permalink
avoid an undef warning on 5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jan 10, 2014
1 parent 0b00536 commit fb98382
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
Revision history for {{$dist->name}}

{{$NEXT}}
- avoid an uninitialized warning on 5.8 from new TEST_METHOD code

0.017 2013-12-03 21:38:07 America/New_York
- add TEST_METHOD env var to limit tests run (thanks,
Expand Down
3 changes: 2 additions & 1 deletion lib/Test/Routine/Runner.pm
Expand Up @@ -91,7 +91,8 @@ sub run {
my @tests = grep { Moose::Util::does_role($_, 'Test::Routine::Test::Role') }
$thing->meta->get_all_methods;

if (length(my $re = $ENV{TEST_METHOD})) {
my $re = $ENV{TEST_METHOD};
if (defined $re and length $re) {
my $filter = try { qr/$re/ } # compile the the regex separately ...
catch { croak("TEST_METHOD ($re) is not a valid regular expression: $_") };
$filter = qr/\A$filter\z/; # ... so it can't mess with the anchoring
Expand Down

0 comments on commit fb98382

Please sign in to comment.