Subject: | SUPER handles unusual class names poorly |
The following three tests fail with the following error.
Unable to create sub named "" at
/home/josh/src/SUPER-1.14/blib/lib/SUPER.pm line 100.
#!perl -T
use Test::More tests => 3;
use SUPER;
use strict;
no strict 'refs'; ## no critic strict
use warnings FATAL => 'all';
{
package Pirate;
sub chumbucket { return 'Ahoy!'; }
sub four_bells { return 'Belay that order!'; }
sub keelhaul { return 'Rub some salt into it, ye scurvy dog.'; }
}
{
# The ... class has a method named 'chumbucket' and inherits from
# Pirate.
*{'...::chumbucket'} = sub { SUPER::super; };
@{'...::ISA'} = 'Pirate';
my $obj = bless [], '...';
eval { is( $obj->chumbucket, Pirate->chumbucket, '...' ); };
if ( $@ ) { diag( $@ ); fail( 'Class ...' ); }
}
{
*{"\n::belay"} = sub { SUPER::super; };
@{"\n::ISA"} = 'Pirate';
my $obj = bless [], "\n";
eval { is( $obj->belay, Pirate->belay ); };
if ( $@ ) { diag( $@ ); fail( 'Class \n' ); }
}
{
*{'0::keelhaul'} = sub { SUPER::super; };
@{'0::ISA'} = 'Pirate';
my $obj = bless [], '0';
eval { is( $obj->keelhaul, Pirate->keelhaul ); };
if ( $@ ) { diag( $@ ); fail( 'Class 0' ); }
}