in reply to XML::Twig and Eval
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Twig and Eval
by Anonymous Monk on Mar 28, 2016 at 09:28 UTC | |
by Corion (Patriarch) on Mar 28, 2016 at 09:34 UTC | |
by jellisii2 (Hermit) on Mar 29, 2016 at 14:10 UTC |