[Bath-pm] OO / global instance variable

Jonathan Stowe jns at gellyfish.com
Tue May 24 10:39:41 PDT 2005


On Tue, 2005-05-24 at 16:26, Andrew McGregor wrote:
> > An OO question.
> 
> The same way as any other global instance variable I guess :)
> 
> package My::Obj;
> 
> use XML::Parser;
> 
> my $var;
> 
> sub handle_char_data {
> 	my ($expat, $text);
> 	$var = $text
> }
> 

You can use a private key in the $expat thing -

   $expat->{_text} = $text;

/J\
-- 

This e-mail is sponsored by http://www.integration-house.com/



More information about the Bath-pm mailing list