Re: [Boston.pm] quick XML::Twig / variable scope problem

2007-08-27 Thread mirod
Alex Brelsfoard wrote: sub main { my $catalog_timestamp; [...] my $catalog_settings = XML::Twig-new( twig_handlers = { 'Item'= \get_catalog_field_names, 'Catalog' = \get_catalog_timestamp,

Re: [Boston.pm] quick XML::Twig / variable scope problem

2007-08-27 Thread Alex Brelsfoard
Thank you all very much. I think this gives me all the answers I need (and then some). I needed to move forward on this project, so for the moment I have taken the ugly route ad made the variables global. But I hope to try applying some of these better methods by the middle of the week. I will

Re: [Boston.pm] quick XML::Twig / variable scope problem

2007-08-25 Thread Ted Zlatanov
On Fri, 24 Aug 2007 19:32:05 -0400 Alex Brelsfoard [EMAIL PROTECTED] wrote: AB I would like to call a function that declares a few variables and then runs AB some XML::Twig processes which in turn access update said original AB variables. AB But I'm getting an error from my twig functions when

Re: [Boston.pm] quick XML::Twig / variable scope problem

2007-08-25 Thread Duane Bronson
No, don't use globals. I'm pretty sure (read: too lazy to test) that you can send an anonymous subroutine like this: my $localobject = new MyTwigClass($catalog_timestamp); twig_handlers = { 'Catalog' = sub { return $localobjext-get_catalog_timestamp(); }, } $localobject will not get garbage

[Boston.pm] quick XML::Twig / variable scope problem

2007-08-24 Thread Alex Brelsfoard
Hi all, I'm trying to do something I see as relatively simple. I would like to call a function that declares a few variables and then runs some XML::Twig processes which in turn access update said original variables. But I'm getting an error from my twig functions when they try to access the

Re: [Boston.pm] quick XML::Twig / variable scope problem

2007-08-24 Thread Jeremy Muhlich
On Fri, 2007-08-24 at 19:32 -0400, Alex Brelsfoard wrote: sub main { my $catalog_timestamp; ... sub get_catalog_timestamp { ... $catalog_timestamp = $elt-att('PublishTimestamp'); Global symbol $catalog_timestamp requires explicit package name Yep. You can get away with