KarateCowboy has asked for the wisdom of the Perl Monks concerning the following question:
So I have this handler, and I want to take that text I am getting and use it in SampleClass. Not sure how.package SampleClass; sub new{ my $class = shift; my $self = {}; $self->{configFile} = shift; $self->{fileContents} = (); $self->{twig} = new XML::Twig(twig_handlers => { tag => \&tagHandler, }); bless $self, $class; } . . . sub tagHandler{ my $twig = shift; my $tag = shift; my $client_name = $tag->first_child('client')->text; my $version = $tag->first_child('version')->text; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing outside variable using XML::Twig
by Joost (Canon) on Jan 31, 2008 at 20:11 UTC | |
by KarateCowboy (Initiate) on Jan 31, 2008 at 20:45 UTC | |
|
Re: Accessing outside variable using XML::Twig
by GrandFather (Saint) on Jan 31, 2008 at 19:42 UTC | |
|
Re: Accessing outside variable using XML::Twig
by mirod (Canon) on Jan 31, 2008 at 20:51 UTC |