Re: Code coverage tools?

[email protected] (Stevan Little)
Newsgroups perl.moose
Message-ID <[email protected]>
On Feb 2, 2008, at 1:44 PM, Noel Maddy wrote:

>>>> "Matt S Trout" <[email protected]> 02/02/08 8:28 AM >>>
>> On Fri, Feb 01, 2008 at 02:57:45PM -0500, Noel Maddy wrote:
>>> I'm starting to work with Moose, and I'm really impressed
>>> with its design.
>>>
>>> However, I'm used to using Devel::Cover for code coverage,
>>> and it seems to skip code in Moose's attribute default coderefs.
>>
>> Not directly a solution, but if you use 'builder' instead of  
>> default (which
>> I pretty much always do) thenthe actual default logic becomes a  
>> method.
>
> Thanks, Matt. I had missed the 'builder' option on attributes.

Yes, builder was a fairly new addition, and honestly the docs need an  
overhaul because there are lots of new features which have been  
introduced which don't get their proper billing in the docs.

> I like that -- it puts the initialization code where it belongs,  
> rather than
> cluttering up the attribute definition.

I agree, anything more than trivial initializers should go in  
builder, that way your subclass can have a chance at it as well.

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