Re: roles verify attribute contents when applied?

[email protected] (Dave Rolsky)
Newsgroups perl.moose
Message-ID <[email protected]>
On Thu, 12 Jan 2012, Edward Allen wrote:

> Ok.  This doesn't really make sense.  Here is the problem:  A role is
> applied to a class, not an object (technically you can apply it to an
> object with Moose::Util::apply_all_roles, but this seems like a Bad
> Idea).  A class doesn't have attributes (well there's a module for
> that, but let's ignore that for the time being).  A class has methods.
> So you can test if a method exists, but not if that method returns a
> particular value.

I don't think applying a role to an object is a Bad Idea at all. That's 
not to say it's always a Good Idea.

It can be very useful, especially if you want to do something like debug 
the behavior of just one object.

That said, the original request may be a case of "back up and explain what 
you're trying to do".


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.