my $self = shift;
my $gv = $self->gv_or_padgv($_[0]);
- my $name = $gv->NAME;
- my $cv = $gv->CV;
+ my $cv = $gv->FLAGS & B::SVf_ROK ? $gv->RV : undef;
+ my $name = $cv ? $cv->NAME_HEK || $cv->GV->NAME : $gv->NAME;
+ $cv ||= $gv->CV;
my $seen = $self->{brd_seen};
my $body;
$body = do {
local @{$self}{qw<brd_sub brd_cur>} = (0, $self->{brd_cur} + 1);
local $seen->{$name} = 1;
- 'sub ' . $self->indent($self->deparse_sub($gv->CV));
+ 'sub ' . $self->indent($self->deparse_sub($cv));
};
if (FOOL_SINGLE_DELIM) {