X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FReturn%2FType%2FLexical.pm;h=b0d870708dbf267f63c6c801b507bb9f8c54cf36;hb=refs%2Fheads%2Fdist;hp=83d4ec1d3bc9eb7c4c27d31635249121123e5b24;hpb=bf3946f1795869e97cd95cec95b7bb82c45a915d;p=chaz%2Fp5-Return-Type-Lexical diff --git a/lib/Return/Type/Lexical.pm b/lib/Return/Type/Lexical.pm index 83d4ec1..b0d8707 100644 --- a/lib/Return/Type/Lexical.pm +++ b/lib/Return/Type/Lexical.pm @@ -7,7 +7,7 @@ use strict; use parent 'Return::Type'; -our $VERSION = '0.001'; # VERSION +our $VERSION = '0.002'; # VERSION sub import { my ($class, %args) = @_; @@ -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}; @@ -52,7 +57,7 @@ Return::Type::Lexical - Same thing as Return::Type, but lexical =head1 VERSION -version 0.001 +version 0.002 =head1 SYNOPSIS