From: Jesse Luehrs Date: Tue, 18 Aug 2009 08:35:33 +0000 (-0500) Subject: comment the 'once' warning issue with sort X-Git-Tag: 0.89_02~56 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a163f54f1bc90a8b575263f7185970fe2dc828b4;p=gitmo%2FMoose.git comment the 'once' warning issue with sort --- diff --git a/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm b/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm index f71f369..9a6dd13 100644 --- a/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm +++ b/lib/Moose/Meta/Attribute/Native/MethodProvider/Array.pm @@ -47,6 +47,13 @@ sub sort : method { if $predicate && ref $predicate ne 'CODE'; if ($predicate) { + # Although it would be nice if we could support just using $a and + # $b like sort already does, using $a or $b once in a package + # triggers the 'Name "main::a" used only once' warning, and there + # is no good way to avoid that, since it happens when the file + # which defines the coderef is compiled, before we even get a + # chance to see it here. So, we have no real choice but to use + # normal parameters. --doy CORE::sort { $predicate->( $a, $b ) } @{ $reader->($instance) }; } else {