package index; sub new { my $that = shift; my $class = ref( $that ) || $that; my $this = { class_map => { date_time => \&date_time, }, # other stuff you want here ... }; return bless $this, $class; } sub date_time { my( $this, $node, $class, $is_end_tag ) = @_; ($node->children())[0]->text( `date` ); }