perl - Trouble with "unblessed reference" when using HTML::TokeParser -


i've been poking , can't around "unblessed reference" error. here's simplified code:

#!/usr/local/bin/perl  use strict; use warnings; use html::tokeparser;  $p = html::tokeparser->new( $argv[0] ); while (my $t = $p->get_tag('img')) {     $src = $t->get_attr('src');     print "$src\n"; } 

and here's error message when try it:

can't call method "get_attr" on unblessed reference @ m:\list_images_in_html.pl line 9. 

i gather somehow it's not recognizing $t token object get_attr method, don't understand why.

according manual (html::tokeparse @ metacpan), get_tag() returns array reference, not object.

you cannot call get_attr() on bog standard array ref.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -