Alex,

> I figured it out. 

Congratulations!

> just figured I'd send out what I did, in case 
> anyone else wanted to know:

Good to have it in the archives for future reference. Thanks for taking
the time to post it back.

I'd assume your production code is longer and more paranoid than the
fragment shown. XML::XPath requires error checking, even though it
doesn't return undef as so many do. E.g.,

> foreach my $kw ($item->find('KEYWORD')->get_nodelist){

Some documents might result in find() returning something that doesn't
respond to get_nodelist. In
http://search.cpan.org/~msergeant/XML-XPath-1.13/XPath.pm#nodeset_=_find
($path,_[$context])
says it could return 

   XML::XPath::NodeSet object containing the nodes it found 
   (or empty if no nodes matched the path), or one of
XML::XPath::Literal 
   (a string), XML::XPath::Number, or XML::XPath::Boolean. It should 
   always return something - and you can use ->isa() to find out what it

   returned. If you need to check how many nodes it found you should
check 
   $nodeset->size

but even that isn't foolproof since XML::XPath::Boolean->size() is
apparently not supported either.


-- Bill
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to