Please supply a complete, self-contained example that exhibits the problem you show.
I can't replicate your problem using the following code. Most likely, you're calling ->text on an undefined value somewhere else in your program:
use strict; use XML::Twig; warn XML::Twig->VERSION; my $twig = XML::Twig->new(); $twig->parse(<<'XML'); <addr> <city/> </addr> XML my $res = eval { $twig->first_child('address')->first_child('city')->text; }; print "Got " . $res; __END__ 3.48 at tmp.pl line 4. Use of uninitialized value $res in concatenation (.) or string at tmp. +pl line 16. Got
In reply to Re: XML::Twig and Eval
by Corion
in thread XML::Twig and Eval
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |