1
2
3
root@raspberrypi:~# perl wlan_off.pl
Can't call method "attr" on an undefined value at wlan_off.pl line 29.
HTML::TreeBuilder=HASH(0xcafe00)root@raspberrypi:~#
1 2 3 4 5
my $code2 = $html->look_down( _tag => q{input}, type => q{hidden}, name => q{code2} )->attr(q{value});
1 2 3 4 5 6 7
my $code2 = ""; if(my $code2input = $html->look_down( _tag => q{input}, type => q{hidden}, name => q{code2})) { $code2 = $code2input->attr(q{value}); }
1 2 3 4
$instanz->methode() or die $@; $instanz->methode() or die $^E; ### VORHER jedoch: Prüfe, ob die Instanz erfolgreich ertellt werden konnte.