For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > June 2005 > XML::Twig -- help with something small









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author XML::Twig -- help with something small
rishid@gmail.com

2005-06-07, 4:01 pm

Hi,

In my perl application, I need to create a lot of twigs, I wanted a way
to quickly create a twig by just passing a subroute Node, Function and
File to parse. I created this, the problem is the Function that is
called ($temp[1]), Perl believe it is a bareword and halts. Is there
anyway to "cast" it so Perl knows it is a subroutine?

Thanks a lot,

Rishi D

use XML::Twig;
use strict;

quickTwig("DBMS", "getXMLDBInfo", "tmp/$inputHash{'host'}/DBList.xml");
sub quickTwig {
# @temp = [Node, Function, File]
my @temp = @_;
my $twig = XML::Twig->new(twig_handlers => { $temp[0] => $temp[1] });
$twig->parsefile($temp[2]);
$twig->purge;
}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com