package XMLParse; use strict; use XML::Parser; sub new { my $class = shift; my $self = { 'i_need_this' => 'important', }; bless $self, $class; return $self; } sub parse { my ($self, $xmlfile) = @_; my $parser = XML::Parser->new( Handlers => {Start => \&handle_start, End => \&handle_end, Char => \&handle_char} ); $parser->parsefile($xmlfile); } sub handle_start { .... } sub handle_end { .... } sub handle_char { .... } 1;