From: Graham Knop Date: Thu, 29 Mar 2018 13:50:39 +0000 (+0200) Subject: check defined rather than truth in weak X-Git-Tag: v2.000000~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=132d8b361b55e7dedb1466ca314cecb142419f35;p=p5sagit%2Fcurry.git check defined rather than truth in weak --- diff --git a/lib/curry.pm b/lib/curry.pm index 2ad9c1c..1a9c237 100644 --- a/lib/curry.pm +++ b/lib/curry.pm @@ -27,7 +27,7 @@ $curry::weak = sub { Scalar::Util::weaken($invocant) if Scalar::Util::blessed($invocant); my @args = @_; sub { - return unless $invocant; + return unless defined $invocant; $invocant->$code(@args => @_) } }; @@ -38,7 +38,7 @@ sub AUTOLOAD { my ($method) = our $AUTOLOAD =~ /^curry::weak::(.+)$/; my @args = @_; return sub { - return unless $invocant; + return unless defined $invocant; $invocant->$method(@args => @_); } }