diff --git a/Basic/Gen/PP.pm b/Basic/Gen/PP.pm index 234849952..292a614c8 100644 --- a/Basic/Gen/PP.pm +++ b/Basic/Gen/PP.pm @@ -666,7 +666,7 @@ sub _pp_addpm_nolineno { if (ref $pm) { my $opt = $pm; $pm = shift; - croak "unknown option" unless defined $opt->{At} && + confess "unknown option '$opt->{At}' (only Top|Bot|Middle)" unless defined $opt->{At} && $opt->{At} =~ /^(Top|Bot|Middle)$/; $pos = $opt->{At}; } else { diff --git a/t/pp_croaking.t b/t/pp_croaking.t index 039a9526d..0368d6ff8 100644 --- a/t/pp_croaking.t +++ b/t/pp_croaking.t @@ -9,6 +9,9 @@ use PDL::PP qw(foo::bar foo::bar foobar); # Prevent file generation (does not prevent calling of functions) $PDL::PP::done = 1; +eval {pp_addpm({At=>'Mid'}, "blah")}; +like $@, qr/Middle/, 'pp_addpm says valid options'; + # Check the loop malformed call: eval { pp_def(test1 =>