my $demolishall = '';
for my $class ($metaclass->linearized_isa) {
no strict 'refs';
+ no warnings 'once';
if (*{$class . '::DEMOLISH'}{CODE}) {
$demolishall .= "${class}::DEMOLISH(\$self);\n";
}
my $pkg = $self->name;
no strict 'refs';
- no warnings 'redefine';
+ no warnings 'redefine', 'once';
*{ $pkg . '::' . $name } = $code;
}
my $code = do{
no strict 'refs';
+ no warnings 'once';
*{ $self->{package} . '::' . $method_name }{CODE};
};
or $self->throw_error('You must define a method name');
return $self->{methods}{$method_name} ||= do{
- my $code = do{ no strict 'refs'; *{$self->{package} . '::' . $method_name}{CODE} };
+ my $code = do{
+ no strict 'refs';
+ no warnings 'once';
+ *{$self->{package} . '::' . $method_name}{CODE};
+ };
($code && $self->_code_is_mine($code)) ? $code : undef;
};
return unless $self->can('BUILD');
for my $class (reverse $self->meta->linearized_isa) {
- my $build = do{ no strict 'refs'; *{ $class . '::BUILD' }{CODE} }
- or next;
+ my $build = do{
+ no strict 'refs';
+ no warnings 'once';
+ *{ $class . '::BUILD' }{CODE};
+ } or next;
$self->$build(@_);
}
# that time (at least tests suggest so ;)
foreach my $class (@{ Mouse::Util::get_linear_isa(ref $self) }) {
- my $demolish = do{ no strict 'refs'; *{ $class . '::DEMOLISH'}{CODE} }
- or next;
+ my $demolish = do{
+ no strict 'refs';
+ no warnings 'once';
+ *{ $class . '::DEMOLISH'}{CODE};
+ } or next;
$self->$demolish();
}