http://www.perlmonks.org?node_id=993585


in reply to Re^2: sub that finds ancestor elements
in thread sub that finds ancestor elements

When I install using "ppm install XML-LibXML" then version 1.70 of XML-LibXML is installed as the latest. Your script indicated "use XML::LibXML 2;". Of course, I get error that version 2 is required.

Replies are listed 'Best First'.
Re^4: sub that finds ancestor elements
by tobyink (Canon) on Sep 14, 2012 at 05:45 UTC

    Replace this:

    $node->findnodes("ancestor::*")->map(sub { $coolNodeName->($_) })

    With this:

    (map { $coolNodeName->($_) } $node->findnodes("ancestor::*"))

    ... and you should be able to use XML::LibXML 1.70.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'