Re: Moose neophyte questions

[email protected] (Dave Rolsky)
Newsgroups perl.moose
Message-ID <[email protected]>
On Mon, 22 Dec 2008, Chris Prather wrote:

>> I'm thinking default => \&sub_name,
>> will do the trick.
>
> that would work as well but 'builder => method_name' is cleaner

And inheritable/overridable.

>> - the coerce keyword can coerce from a number of things. If it is
>>  coercing from Object, how does it know that $_ is an Object? If it
>>  is to coerce from Str, how does it know that $_ is a Str?
>
> To check if an Object is an Object it uses Scalar::Util's blessed(),
> and a Str is a Str if it isn't a ref, and doesn't look like a number
> (using I believe Scalar::Utils looks_like_number).

Actually, a Str is any defined non-reference. It can look like a number. 
Under the hood, Value and Str are exactly the same, cause this is Perl.


-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.