From: Florian Ragwitz Date: Sun, 24 May 2009 15:14:10 +0000 (+0200) Subject: Fail hard if strip_names_and_args fails. X-Git-Tag: 0.005003~2^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-Declare.git;a=commitdiff_plain;h=79f9fba8cbbd3ffd2cd3704dc9e8be5a02f41ac7 Fail hard if strip_names_and_args fails. --- diff --git a/lib/Devel/Declare/Context/Simple.pm b/lib/Devel/Declare/Context/Simple.pm index 8d83cdf..8cbc8c1 100644 --- a/lib/Devel/Declare/Context/Simple.pm +++ b/lib/Devel/Declare/Context/Simple.pm @@ -133,9 +133,9 @@ sub strip_names_and_args { while (1) { # Get the bareword my $thing = $self->strip_name; - # If there's no bareword here, bail the caller can check if - # we returned anything. - return unless defined $thing; + # If there's no bareword here, bail + confess "failed to parse bareword. found ${linestr}" + unless defined $thing; $linestr = $self->get_linestr; if (substr($linestr, $self->offset, 1) eq '(') { @@ -168,14 +168,14 @@ sub strip_names_and_args { } else { # fail if it isn't there - #FIXME + confess "couldn't find closing paren for argument. found ${linestr}" } } else { # No parens, so expect a single arg my $thing = $self->strip_name; - # If there's no bareword here, bail the caller can check if - # we returned anything. - return unless defined $thing; + # If there's no bareword here, bail + confess "failed to parse bareword. found ${linestr}" + unless defined $thing; $linestr = $self->get_linestr; if (substr($linestr, $self->offset, 1) eq '(') { # This one had a proto, pull it out