html - Can't call method "setValue" on an undefined value - perl -


use strict; use warnings; use utf8; use 5.010; use html::html5::parser;  open (file, '<links.txt') ;  @lines = <file>; $i; $a = $lines[$i];  $xml = html::html5::parser->load_html(location => $a) ; 

got error: "can't call method "setvalue" on undefined value @ c:/dwimperl/perl/site/lib/ html/html5/parser/tagsoupparser.pm line 2946"

i've tried insert if , define value first doesn't work.

i'm @ beginning of learning perl, here me this?

use strict; use warnings; use utf8; use 5.010; use html::html5::parser; use try::tiny;  open (my $file, '<', 'links.txt') ; @lines = <$file>; $i = 0; foreach $a (@lines) {     $xml = try {         html::html5::parser->load_html(location => $a)     } catch {         warn "bad line [$i][$a]";         warn "actual error: $_";     };     $i++; } 

i've cleaned code best guess how it's supposed structured, , added try/catch block (using try::tiny) demonstrate method of identifying problem lines.

you need identify input causing problem before can diagnose problem.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -