in reply to importing a function

If I understand your question correctly then you probably want something like this
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'}; } }
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 ;)
HTH

_________
broquaint

Replies are listed 'Best First'.
Re2: importing a function
by dragonchild (Archbishop) on Feb 12, 2003 at 17:44 UTC
    That does solve the problem of clobbering import(). However, how would one go about solving this problem for classes that have use base?

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

      However, how would one go about solving this problem for classes that have use base?
      Since base updates the @ISA of each package that shouldn't be a problem.
      HTH

      _________
      broquaint