Attempt

 view release on metacpan or  search on metacpan

lib/Sub/Attempts.pm  view on Meta::CPAN

is inherited and not overridden) then you should use the C<method>
parameter:

    attempts("get_pie", tries => 3, method => 1);

This has the same effect as writing:

    sub get_pie
    {
      my $self = shift;
      $self->SUPER::get_pie(@_);
    }

    attempts("get_pie", tries => 3);

If a method is defined by a subroutine in the current package then
the C<method> parameter has no effect

=cut

sub attempts

lib/Sub/Attempts.pm  view on Meta::CPAN

    if ($args{method})
    {
      # this eval is here as we need to switch packages to declare a
      # subroutine so SUPER works and with the current limitations of
      # perl, there's no way to do that by mucking about with
      # typeglobs.
      eval qq{package $package;
              sub $subname
              {
                 my \$this = shift;
                 \$this->SUPER::$subname(\@_)
              }
      };
      $old_sub = *{ $glob }{CODE};
    }
    else
    {
      croak "Can't wrap '$subname', doesn't exist in package '$package'"
    }
  }



( run in 0.364 second using v1.01-cache-2.11-cpan-454fe037f31 )