my $country; eval { my $countryId = Country::Identifier->new(id => $card->country); $country = Country::Factory->new(id => $countryId); my $cntry_formatter = Formatter::Factory->new(action => sub { "[" . shift() . "]" }); $country->apply(Iterator->new(type => "closure", args => [ $cntry_formatter ])); }