in reply to To Moose or not To Moose.. ?
That seems a bit over-engineered…depending on how/where you use it. I would go with something more like this + some sub exporting (one function, probably with a less generic name) before resorting to objects. It’s really just a simple lookup.
package OHAI; use strict; use warnings; use Carp; our %Status = map {; $_ => 1 } qw( MMR MM IRN IR CUB CU SSD SS PRK PK SYR SY ); sub status { my $country_code = shift || croak "status requires country code"; $Status{uc$country_code} || croak "Country code '$country_code' un +defined"; } 1; __DATA__ =head1 Do you even Pod, bro? OHAI - ... =cut
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: To Moose or not To Moose.. ?
by PerlSufi (Friar) on Jun 09, 2014 at 20:51 UTC |