开发者

using the DIAMOND operator with xml::twig

I have the following xml::twig

my开发者_如何学JAVA $t = XML::Twig->new(
twig_handlers => {

 r => sub {   #my code here}            

 );
$t->parse( <>); #I want here to read multiple files as input and parse them but get an error ,

is it possible to do that with xml::twig ?


The XML::Twig::parse method takes a single scalar argument, not a list, so parse(<>) is the wrong approach.

But what about

$t->parse(  join "", <>  )

?


I don't think this is possible. From perldoc perlvar:

ARGV

The special filehandle that iterates over command-line filenames in @ARGV. Usually written as the null filehandle in the angle operator "<>". Note that currently "ARGV" only has its magical effect within the "<>" operator; elsewhere it is just a plain filehandle corresponding to the last file opened by "<>". In particular, passing "*ARGV" as a parameter to a function that expects a filehandle may not cause your function to automatically read the contents of all the files in @ARGV.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜