> 
> Why dont you just define the function outside and call them from inside 
> your master function
> 
> Bernd Prager wrote:
> > 
> > I run into a problem and would appreciate some help.
> > 
> > I'd like to write a subroutine that parses an XML file.
> > I use XML::Parse and one way that works is to define
> > subroutines with the name of an XML tag and every appearance
> > of that tag calls the appropriate subroutine.
> > 
> > Since I want to have this procedure entirely encapsulated in 
> > my funtion I end up defining nested subroutines:
> > 
> > sub myParse {
> >    my $content;
> >    
> >    sub myXMLtag {
> >       (... do something with $content...)
> >    }
> > 
> > }
> > 
> > Now I'm getting error messages "Variable "$content" will not stay shared".
> > 
> > I read something about anonymous functions to prevend this error but
> > I can't do that here since XML::Parse requires the function names
> > the same as the XML tags.

The reason is that some XML tags conflict with other naming conventions I use.
And it is not very expressive to have function names that are called "value" and 
"item". 

But I did find a way to prevend the error message. I just have to use full
qualified variable names like "$myParse::content". That works for me. :))



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to