in reply to Overriding of a method
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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Overriding of a method
by gv11ng (Initiate) on Nov 30, 2005 at 16:32 UTC | |
by Nomad (Pilgrim) on Nov 30, 2005 at 18:37 UTC |