use strict; package TestA; sub new { bless {}, shift; } sub doit { my $self = shift; warn 'A::doit'; } package TestB; use base 'TestA'; sub doit { my $self = shift; warn 'B::doit'; $self->SUPER::doit(); } package TestC; use base 'TestB'; package TestD; sub new { bless {}, shift; } sub doit { my $self = shift; warn 'D::doit'; } package main; my $c = TestC->new; *TestC::doit = sub { my $self = shift; local *TestA::doit = \&TestD::doit; $self->TestB::doit(); }; $c->doit();
In reply to Re: Is there a way to dynamically copy subroutine from one module to another?
by Arunbear
in thread Is there a way to dynamically copy subroutine from one module to another?
by OlegG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |