diff options
author | Steffen Mueller <smueller@cpan.org> | 2011-02-19 14:01:48 +0100 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2011-07-12 20:54:50 +0200 |
commit | ab018b010dc7d4695e222a3f411941eb8d39e681 (patch) | |
tree | 16d35ff5ad984e56897d36a5a770e38445cda0f2 | |
parent | 69b19f32a0680f8a57aec35c0330e8bef0bf7a49 (diff) | |
download | perl-ab018b010dc7d4695e222a3f411941eb8d39e681.tar.gz |
Better error checking/handling
-rw-r--r-- | dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm index 9755293c1f..9bb530763f 100644 --- a/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm +++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/Typemaps.pm @@ -433,6 +433,8 @@ object for the entry if found. sub get_typemap { my $self = shift; + die("Need named parameters, got uneven number") if @_ % 2; + my %args = @_; my $ctype = $args{ctype}; die("Need ctype argument") if not defined $ctype; @@ -465,6 +467,8 @@ object for the entry if found. sub get_inputmap { my $self = shift; + die("Need named parameters, got uneven number") if @_ % 2; + my %args = @_; my $xstype = $args{xstype}; my $ctype = $args{ctype}; @@ -475,7 +479,9 @@ sub get_inputmap { if defined $xstype and defined $ctype; if (defined $ctype) { - $xstype = $self->get_typemap(ctype => $ctype)->xstype; + my $tm = $self->get_typemap(ctype => $ctype); + $xstype = $tm && $tm->xstype; + return() if not defined $xstype; } my $index = $self->{input_lookup}{$xstype}; @@ -499,6 +505,8 @@ object for the entry if found. sub get_outputmap { my $self = shift; + die("Need named parameters, got uneven number") if @_ % 2; + my %args = @_; my $xstype = $args{xstype}; my $ctype = $args{ctype}; @@ -509,7 +517,9 @@ sub get_outputmap { if defined $xstype and defined $ctype; if (defined $ctype) { - $xstype = $self->get_typemap(ctype => $ctype)->xstype; + my $tm = $self->get_typemap(ctype => $ctype); + $xstype = $tm && $tm->xstype; + return() if not defined $xstype; } my $index = $self->{output_lookup}{$xstype}; |