It depends if the attribute operates during the BEGIN phase or CHECK
or INIT.  The latter two don't play well with mod_perl.  There are
various workarounds for this that you can see in the inside-out
modules that use attributes (Object::InsideOut and Class::Std).

Also, unless you use Attribute::Handlers or, again, do some special
workarounds, then your attributes won't play well with any other
attributes modules that use different methods.  Attribute::Handlers is
the closest to a standard that lets attribute modules play well
together.

Regards,
David Golden

On 9/21/06, Ovid <[EMAIL PROTECTED]> wrote:
Hi all,

Some folks are happy with my Class::Trait module, but not entirely happy with the the 
fact that "private" trait methods currently must be declared as lexical methods:

  my $meth = sub { ... };

  sub foo { shift->$meth }

Praveen Ray has sent me a patch which lets authors do this:

  sub meth : private { ... }

  sub foo { shift->meth }

That's a much nicer syntax but I also realize that a number of folks aren't keen on 
attributes.  This attribute is read by "use attributes" 
(http://search.cpan.org/src/NWCLARK/perl-5.8.8/lib/attributes.pm), a nice, core module, 
but I'm wondering if there are any pitfalls here I should be aware of?

Cheers,
Ovid

--
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/




Reply via email to