diff --git a/ack b/ack index d7266f1..7ddf60c 100755 --- a/ack +++ b/ack @@ -215,6 +215,7 @@ MAIN: { if ( $App::Ack::is_filter_mode && !$opt->{files_from} ) { # probably -x $files = App::Ack::Files->from_stdin(); $opt_regex //= shift @ARGV; + defined $opt_regex or App::Ack::die( 'No regular expression found.' ); ($re_match, $re_not, $re_hilite, $re_scan) = App::Ack::build_all_regexes( $opt_regex, $opt ); $stats{re_match} = $re_match; $stats{re_not} = $re_not; @@ -227,6 +228,7 @@ MAIN: { } else { $opt_regex //= shift @ARGV; + defined $opt_regex or App::Ack::die( 'No regular expression found.' ); ($re_match, $re_not, $re_hilite, $re_scan) = App::Ack::build_all_regexes( $opt_regex, $opt ); $stats{re_match} = $re_match; $stats{re_not} = $re_not; diff --git a/lib/App/Ack.pm b/lib/App/Ack.pm index 49101e2..0f4d45d 100644 --- a/lib/App/Ack.pm +++ b/lib/App/Ack.pm @@ -745,8 +745,6 @@ sub build_regex { my $str = shift; my $opt = shift; - defined $str or App::Ack::die( 'No regular expression found.' ); - # Check for lowercaseness before we do any modifications. my $regex_is_lc = App::Ack::is_lowercase( $str ); diff --git a/t/boolean.t b/t/boolean.t index 00240b5..a7ffc9b 100644 --- a/t/boolean.t +++ b/t/boolean.t @@ -9,7 +9,7 @@ use Test::More; use lib 't'; use Util; -plan tests => 4; +plan tests => 8; prep_environment(); @@ -106,6 +106,9 @@ NOT: { } +exit 0; # XXX There is stuff after this that should work. + + AND: { _movies_are( [qw( Aykroyd )],