Re: Bug in empty method of MooseX::AttributeHelpers::MethodProvider::List?

[email protected] (Sartak)
Newsgroups perl.moose
Message-ID <[email protected]>
Hi Tod,

On Thu, Oct 9, 2008 at 6:39 PM, Tod Hagan <[email protected]> wrote:
> All,
>
> Shouldn't
>
>        sub empty : method {
>            my ($attr, $reader, $writer) = @_;
>            return sub {
>                scalar @{$reader->($_[0])} ? 1 : 0
>            };
>        }
>
> instead say:
>
>        scalar @{$reader->($_[0])} ? 0 : 1

Yes. Unfortunately it's way too late to break back-compat. :(

It's documented somewhere in the dist that the empty method is
deprecated because of exactly this.

> Also, I'm unfamiliar with the ': method' business after the subroutine
> name, can someone explain?

That's to tell Perl to not generate the warning "Ambiguous call
resolved as CORE::foo". perldoc attributes has more information.

>
> Thanks.
>
> Tod

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