X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMethod%2FGenerate%2FAccessor.pm;h=4a8ecd39638550e298af2963250ee2cfa7de2cfa;hb=faa9ce11cefee1e6f7800ec1dbe561717c162161;hp=13e6ccc0a5ed01a0c5931da3e493db527192d7a2;hpb=edb9977c5fa2b2a737ab19ce83f934253c74611f;p=gitmo%2FRole-Tiny.git diff --git a/lib/Method/Generate/Accessor.pm b/lib/Method/Generate/Accessor.pm index 13e6ccc..4a8ecd3 100644 --- a/lib/Method/Generate/Accessor.pm +++ b/lib/Method/Generate/Accessor.pm @@ -372,7 +372,7 @@ sub _generate_simple_set { my $simple = "${me}->{${name_str}} = ${value}"; if ($spec->{weak_ref}) { - { local $@; require Scalar::Util; } + require Scalar::Util; # Perl < 5.8.3 can't weaken refs to readonly vars # (e.g. string constants). This *can* be solved by: @@ -387,7 +387,7 @@ sub _generate_simple_set { eval { Scalar::Util::weaken($simple); 1 } or do { if( \$@ =~ /Modification of a read-only value attempted/) { - { local $@; require Carp; } + require Carp; Carp::croak( sprintf ( 'Reference to readonly value in "%s" can not be weakened on Perl < 5.8.3', $name_str,