in reply to Perl objects and code references

You're trying to pass an object function call ($self->handle_end()) as an object reference. The code you've got will attempt to dereference $self as a code reference, which it isn't.

Instead, you need to create an anonymous subroutine that will pass the correct value of $self along to XML::Parser. Anonymous subroutines are neat, if easy to abuse.

The important thing about anonymous subroutines, also known as closures, is that they hang onto the value of any lexical variables inside it. Read perlman:perlsub for more about closures. So, if I created an anonymous subroutine inside a hash, like so:

my $self = Foo->new(); my $mysub = sub { $self->increment() };
...and then later on used it:
$mysub->();
Then the correct value of $self would be have increment() called on it.

So, in order to fix your problem, you need to create closures around your method calls. I'll leave the rest to you. :)

stephen