Re: Accessor to module
[email protected] (Stevan Little)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
Bianka,
On May 31, 2007, at 11:57 AM, Bianka Martinovic wrote:
> when playing around with Moose I tried to create an accessor like
> this:
>
> has 'loader' => (
> is => 'ro',
> isa => 'CM::Module::Loader',
> required => 1,
> lazy => 1,
> default => sub {
> CM::Module::Loader->new;
> },
> );
> I realized that the new() method of CM::Module::Loader is called
> whenever I use the accessor.
Actually, it shouldn't be, it should only call the 'default' sub the
first time the ->loader accessor is called. After that, it stores the
newly create CM::Module::Loader instance. Please be 100% sure that
this is happening, and then it would be greatly appreciated if you
could provide a runnable example exhibiting the issue.
Thanks,
- Stevan