Subject: | uninitialized value in subroutine encode_entities |
Date: | Wed, 23 Sep 2009 13:06:08 +0200 |
To: | bug-HTML-Parser [...] rt.cpan.org |
From: | Foobar <entor1 [...] web.de> |
Hello, this is Detlef.
This is for package
HTML::Entities (version: 3.57)
perl -v says:
This is perl, v5.10.0 built for i486-linux-gnu-thread-multi
uname -a says:
Linux HOST 2.6.28-15-generic #49-Ubuntu i686 GNU/Linux
----------------
As i used HTML::ElementTable, i came into the situation, that
"$table->blank_fill(1)" didn't work (which should replace empty table
cells with ' ').
So i decided to use another solution, like this:
use HTML::ElementTable;
use HTML::ElementRaw;
my $table = new HTML::ElementTable maxrow => 0, maxcol => 0;
my $er = new HTML::ElementRaw;
my $txt = ' ';
$er->push_content($txt);
$table->cell(0,0)->replace_content($er);
This works fine and produces html as i expected. But there were these
warning messages:
Use of uninitialized value in substitution (s///)
at /usr/lib/perl5/HTML/Entities.pm line 469.
Use of uninitialized value $html[42] in join or string
at /usr/share/perl5/HTML/Element.pm line 1622.
When i looked into the subroutine HTML::Entities::encode_entities i were
able to correct this problem with on single line:
$$ref = '' unless $$ref;
This line comes right after the if statement at the beginning ...
my $ref;
if (defined wantarray) {
my $x = $_[0];
$ref = \$x; # copy
} else {
$ref = \$_[0]; # modify in-place
}
$$ref = '' unless $$ref;
------------------------------------------------------
So, do you like to change HTML::Entities in that way?
Thank you
Detlef :)