##
_proc => \$action1,
####
package Engine;
use strict;
use My::Module;
my $action1 = sub
{
$pkt = shift; #where $pkt is an object of type My:Module:Object
my $id = $pkt->get('ID');
#........
#do this
#do that...
print $id;
}
sub new
{
my $class = @_;
return bless {
_xp => My::Module->new(),
_proc => $action1,
}
};
sub routine
{
my $s = shift;
$s->{_xp}->process();
my @arr = $s->{_xp}->getvalues("packet");
map($action1->($_), @arr);
}