X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-Return-Type-Lexical;a=blobdiff_plain;f=lib%2FReturn%2FType%2FLexical.pm;h=8da614a016af249c35d1c7308343b08cddf56485;hp=a6d58073a0a3c0535a0af10f867c57037df1c507;hb=e4f3813b56f71b0ac62ca16d6a005ae9d4f1c837;hpb=f8823f39a5d36152707d4ba27c1452e943812263 diff --git a/lib/Return/Type/Lexical.pm b/lib/Return/Type/Lexical.pm index a6d5807..8da614a 100644 --- a/lib/Return/Type/Lexical.pm +++ b/lib/Return/Type/Lexical.pm @@ -19,12 +19,17 @@ sub unimport { } sub _in_effect { - my $level = shift // 0; + my ($level) = @_; + $level = 0 if !defined $level; my $hinthash = (caller($level))[10]; my $in_effect = $hinthash->{'Return::Type::Lexical/in_effect'}; return !defined $in_effect || $in_effect; } +# XXX This is kind of janky. It relies upon Return::Type using Attribute::Handlers, and it assumes +# some internal Attribute::Handlers behavior. If it proves to be too fragile, we may need to copy +# the Return::Type code to here. Or make Return::Type lexical if that can be done without breaking +# backward-compatibility. my $handler; BEGIN { $handler = $UNIVERSAL::{ReturnType};