Subject: | insert_before, insert_after in PPI::Statement misuse isa return values. |
This was from version 1.000, pulled off CPAN. Looks like the code the same in 1.001. This patch doesn't make inserting elements work, as __insert_before and __insert_after don't do any work.
Smallest code that causes the problem:
my $token = PPI::Token->new('');
$token->set_content('perl code');
my $end_element = $Document->find_first('Statement::End');
$end_element->insert_before($token);
Error message:
Can't call method "isa" without a package or object reference at /usr/local/share/perl/5.8.4/PPI/Statement.pm line 243.
A patch:
242c242,243
< my $Element = isa($_[0], 'PPI::Element') or return undef;
---
Show quoted text
> my $Element = $_[0];
> isa($Element, 'PPI::Element') or return undef;
254c255,256
< my $Element = isa($_[0], 'PPI::Element') or return undef;
---
Show quoted text> my $Element = $_[0];
> isa($Element, 'PPI::Element') or return undef;
This was my first bug into rt, so please let me know if you'd like any other information, and i'll try to provide it.