# declare lexical variable *outside the scope of the eval* my $BusUrl; # trap potential error eval { $BusUrl = $contact->getElementsByTagName( "BusinessUrl" ); }; # check if tag retrieval failed if($@) { # assign an empty (but defined) string $BusUrl = ''; } $bus_url = $BusUrl->item( 0 )->getChildAtIndex( 0 )->getData();
__________
The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.
- Terry Pratchett
In reply to Re: use XML::DOM - what to do with empty tags?
by EvanK
in thread use XML::DOM - what to do with empty tags?
by kevyt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |