Hi,
I've run into "Can't call method "add_statement" on an undefined value" running Devel::Cover. Apologies if this was reported before, but the list archive is not searchable. I am using perl 5.8.4 and Devel::Cover 0.46.
To reproduce the bug, run
/opt/perl/bin/perl -MDevel::Cover -MFooBar -e "FooBar->new->test_foo"
The files FooBar.pm and CodeRef.pm are attached.
The bug occurs while calling $sub in CodeRef::to_string. It is probably related to using B::Deparse, but I was not able to minimize the code further and still reproduce the error.
Simon --
Simon (Vsevolod ILyushchenko) [EMAIL PROTECTED]
http://www.simonf.comTerrorism is a tactic and so to declare war on terrorism is equivalent to Roosevelt's declaring war on blitzkrieg.
Zbigniew Brzezinski, U.S. national security advisor, 1977-81
package FooBar;
sub new {
my $proto = shift;
my $self = {};
bless $self, $proto;
return $self;
}
use CodeRef;
my $sub = sub {
my $str1 = shift;
};
my $assertion = CodeRef->new($sub);
*{"FooBar::test_foo"} =
sub {
my $self = shift;
$assertion->do_assertion(@_);
};
1;
package CodeRef;
use strict;
sub new {
my $class = shift;
my $code = shift;
bless \$code => $class;
}
sub do_assertion {
my $self = shift;
$self->to_string("aaa");
}
sub to_string {
my $self = shift;
require B::Deparse;
my $deparser ||= B::Deparse->new("-p");
$deparser->coderef2text($$self);
}
1;
