There's a couple of options. If you're creating instances of the objects, rather than just calling methods in the namespace, you can use inheritance:
use My::MIME::Lite; my $mime = My::MIME::Lite->new() $mime->send() ##### package My::MIME::Lite; use base qw(MIME::Lite); sub send { my $self=shift; # override the behavior here. You can call $self->MIME::Lite::send( +) # or $self->SUPER::send() } 1;
or, if you don't mind the warning, you can redeclare the method, in the original namespace (this is very bad, if you're using mod_perl, or something else where multiple scripts share the same modules)
use MIME::Lite; sub MIME::Lite::send { # do whatever here, but you can't call back to the 'real' MIME::Lite +::send }
In reply to Re: Overriding of a method
by jhourcle
in thread Overriding of a method
by gv11ng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |