in reply to Objects, callbacks and XML::Parser

The handlers aren't being called as methods on your instance. Instead perhaps you should pass an anonymous coderef which turns the callback into a method call?

my $p = XML::Parser->new( Handlers => { Start => sub { $self->handle_start( @_ ) }, Default => sub { $self->handle_char( @_ ) }, }, );

Additionally: be aware that defining subs nested inside of subs doesn't create lexically scoped subs; they're still members of the package in which they're declared, and in fact doing things this way can lead to strange warning messages (the infamous "variable will not stay shared" seen often in mod_perl circles; see "my () Scoped Variable in Nested Subroutines" for an explanation).

Replies are listed 'Best First'.
Re^2: Objects, callbacks and XML::Parser
by ixl (Initiate) on Dec 11, 2006 at 09:23 UTC
    that works perfectly. many thanks