From fa3bbd3b414c1c0e8cf0a5ccbf6863754bbee9b6 Mon Sep 17 00:00:00 2001 From: Buddy Burden Date: Tue, 12 Apr 2011 15:32:02 -0700 Subject: [PATCH] no need to check for existence of required parameters --- lib/Method/Signatures.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Method/Signatures.pm b/lib/Method/Signatures.pm index 3924d16..fff4d05 100644 --- a/lib/Method/Signatures.pm +++ b/lib/Method/Signatures.pm @@ -711,7 +711,8 @@ sub inject_for_type_check my $class = ref $self || $self; my ($sig) = @_; - return "${class}->type_check('$sig->{type}', $sig->{passed_in}, '$sig->{name}') if $sig->{exists};"; + my $check_exists = $sig->{is_optional} ? "if $sig->{exists}" : ''; + return "${class}->type_check('$sig->{type}', $sig->{passed_in}, '$sig->{name}') $check_exists;"; } sub signature_error {