+ - Revert 'local $@' around require calls to avoid triggering Unknown Error
- Explicitly require Role::Tiny in Role::Tiny::With (RT#70446)
0.009013 - 2011-12-23
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:
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,
$body .= ' my $new = '.$self->construction_string.";\n";
$body .= $self->_assign_new($spec);
if ($into->can('BUILD')) {
- { local $@; require Method::Generate::BuildAll; }
+ require Method::Generate::BuildAll;
$body .= Method::Generate::BuildAll->new->buildall_body_for(
$into, '$new', '$args'
);
@{*{_getglob("${target}::ISA")}{ARRAY}} = @_;
};
*{_getglob("${target}::with")} = sub {
- { local $@; require Moo::Role; }
+ require Moo::Role;
die "Only one role supported at a time by with" if @_ > 1;
Moo::Role->apply_role_to_package($target, $_[0]);
};
*{_getglob("${target}::has")} = sub {
my ($name, %spec) = @_;
($MAKERS{$target}{accessor} ||= do {
- { local $@; require Method::Generate::Accessor; }
+ require Method::Generate::Accessor;
Method::Generate::Accessor->new
})->generate_method($target, $name, \%spec);
$class->_constructor_maker_for($target)
};
foreach my $type (qw(before after around)) {
*{_getglob "${target}::${type}"} = sub {
- { local $@; require Class::Method::Modifiers; }
+ require Class::Method::Modifiers;
_install_modifier($target, $type, @_);
};
}
{
no strict 'refs';
@{"${target}::ISA"} = do {
- { local $@; require Moo::Object; } ('Moo::Object');
+ require Moo::Object; ('Moo::Object');
} unless @{"${target}::ISA"};
}
}
my ($class, $target, $select_super) = @_;
return unless $MAKERS{$target};
$MAKERS{$target}{constructor} ||= do {
- {
- local $@;
- require Method::Generate::Constructor;
- require Sub::Defer;
- }
+ require Method::Generate::Constructor;
+ require Sub::Defer;
my ($moo_constructor, $con);
if ($select_super && $MAKERS{$select_super}) {
->new(
package => $target,
accessor_generator => do {
- { local $@; require Method::Generate::Accessor; }
+ require Method::Generate::Accessor;
Method::Generate::Accessor->new;
},
construction_string => (
*{_getglob "${target}::has"} = sub {
my ($name, %spec) = @_;
($INFO{$target}{accessor_maker} ||= do {
- { local $@; require Method::Generate::Accessor; }
+ require Method::Generate::Accessor;
Method::Generate::Accessor->new
})->generate_method($target, $name, \%spec);
$INFO{$target}{attributes}{$name} = \%spec;
return $new_name if $Role::Tiny::COMPOSED{class}{$new_name};
- { local $@; require Sub::Quote; }
+ require Sub::Quote;
$me->SUPER::create_class_with_roles($superclass, @roles);
# can't just ->can('can') because a sub-package Foo::Bar::Baz
# creates a 'Baz::' key in Foo::Bar's symbol table
return 1 if grep !/::$/, keys %{_getstash($_[0])||{}};
- { local $@; require "${proto}.pm"; }
+ { require "${proto}.pm"; }
return 1;
}
# inflate constant subs into real subs) - also add '' to here (this
# is used later)
@{$INFO{$target}{not_methods}={}}{
- '', map { *$_{CODE}||() } grep !_is_scalar_ref($_), values %$stash
+ '', map { *$_{CODE}||() } grep !ref($_), values %$stash
} = ();
# a role does itself
$APPLIED_TO{$target} = { $target => undef };
my $code = *{$stash->{$_}}{CODE};
# rely on the '' key we added in import for "no code here"
exists $not_methods->{$code||''} ? () : ($_ => $code)
- } grep !_is_scalar_ref($stash->{$_}), keys %$stash
+ } grep !ref($stash->{$_}), keys %$stash
};
};
}
# determine already extant methods of target
my %has_methods;
@has_methods{grep
- +(_is_scalar_ref($stash->{$_}) || *{$stash->{$_}}{CODE}),
+ +(ref($stash->{$_}) || *{$stash->{$_}}{CODE}),
keys %$stash
} = ();