in reply to importing a function
So that'll add define_attributes() to any parent classes that don't already have that defined. I haven't tested it so I can vouch for it's safety ;)BEGIN { *old_import = \&import if defined &import; } sub import { _init(@ISA); goto &old_import if defined &old_import; } sub _init { foreach(@_) { _init(@{$_."::ISA"}) if exists ${$_.'::'}{ISA}; *{$_."::define_attributes"} = \&define_attributes unless defined &{$_.'::define_attributes'}; } }
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re2: importing a function
by dragonchild (Archbishop) on Feb 12, 2003 at 17:44 UTC | |
by broquaint (Abbot) on Feb 12, 2003 at 18:00 UTC |