Well, ... isn't sufficient for reproducing
Anyway the error message I get is Use of uninitialized value $Foo::a in numeric comparison (<=>) at - line 2.
#!/usr/bin/perl --
use strict; use warnings; use Data::Dump qw/ dd /;
{ package Foo; sub Foo::comp { $b <=> $a } }
{ package Oof; sub Oof::comp { $::b <=> $::a } }
sub pomc { $b <=> $a }
dd( [ sort { pomc() } 1..10 ] );
dd( [ sort { Foo::comp() } 1..10 ] );
{
my @f = 1..10;
my $cb = \&Foo::comp;
dd( [ sort $cb @f ] );
$cb = \&pomc;
dd( [ sort $cb @f ] );
$cb = \&Oof::comp;
dd( [ sort $cb @f ] );
}
__END__
$Foo::a is not the same as $main::a aka $::a aka
perlvar#
$a