[rt-users] A way to overload in _Local.pm
Anthony R. J. Ball
ant at suave.net
Tue Jul 26 14:14:11 EDT 2005
I was noticing on the wiki page
http://wiki.bestpractical.com/index.cgi?CleanlyCustomizeRT
That people kept pointing out that changes in the
_Local overrides would replace the original subroutine.
There _is_ a way to leave the old call available for
calling from the new call, which I updated on the wiki,
I thought I would post it here as well in case it helps
anyone.
Basically you can alias the old routine to a new name, then
replace the old name, allowing your to call the old from the
new, here is an example.
*_Load = \&Load;
*Load = sub { print STDERR "Overriding Load\n"; &_Load };
When Load is called it will print, then call the old Load, now at
_Load, with the same arg list as Load got. (to change the arg list
simply change to _Load(arg1,arg2,etc).
Hope someone finds this useful, I didn't see any other similar
posts.
--
www.suave.net - Anthony Ball - ant at suave.net
OSB - http://rivendell.suave.net/Beer
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
TomDOS 4.01: Floppy hat support added
More information about the rt-users
mailing list