[Pdx-pm] Poll: traits

Ovid publiustemp-pdxpm at yahoo.com
Sat Nov 19 13:22:41 PST 2005


--- chromatic <chromatic at wgz.org> wrote:
> Better (I hope Curtis's code does this, because it's immensely
> important), if you have a class, you automatically get a trait
> with the same name as that class with the same methods of that
> class
<snip>

Minor correction:  while I had originally written a "Class::Trait"
module, the current code is actually the work of Stevan Little and I am
merely the maintainer.

Question:  are you saying that if I have this:

  package Foo;

  sub new { bless {} => shift }

  sub name { return "Some name" }

That this should automatically be considered a trait, too?  Currently
to make this is a trait you have to add "use Class::Trait 'base'" to
the package.

There are a number of reasons for this, but the most important is the
internal introspection mechanism involved.

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


More information about the Pdx-pm-list mailing list