[xml] XML callback functions



I am writting a class that will use XML::LibXML and I am using the
callback methods in order
to feed it a dtd. I need to know if I can give the callback a method
call instead of a reference to
a sub-routine.

Where I would

XML::LibXML->read_callback(\&mycustomsub);

can I say;

my $self = {};

bless $self, $class;

XML::LibXML->read_callback($self->mycustommethod);

sub mycustommethod {
    my $self = $_[0];
    my $handle = $_[1];
    my $length = $_[2];
    my $buffer;

    read ($self->{IOSTREAM}, $buffer, $length);
    return $buffer;
}

Will something like this work or is there a better way.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]