http://www.perlmonks.org?node_id=489740


in reply to Re: Package-specific Attribute Handling and Multiple Inheritence
in thread Package-specific Attribute Handling and Multiple Inheritence

Thanks, I have started looking at Attribute::Handlers myself in the meantime. It does look a little scary inside, but I guess that cannot be avoided when dealing with attributes, and as you say, with its centralized handler that just dispatches to the actual attribute handlers it is quite interoperable when many modules try to register attributes.

Since this is for CGI::Application, it would have to play nice with mod_perl, though ... (I have recently even had a bug report from someone using Apache::Reload, which makes things even more tricky)

  • Comment on Re^2: Package-specific Attribute Handling and Multiple Inheritence

Replies are listed 'Best First'.
Re^3: Package-specific Attribute Handling and Multiple Inheritence
by xdg (Monsignor) on Sep 07, 2005 at 02:05 UTC

    Just make sure your handlers all run in the BEGIN phase. That will limit some of what you can do with them -- for example, you can get the name of a subroutine, but the code reference won't yet be defined. But that's no different than writing your own attribute handling code, so you've probably already dealt with it.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.