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
In reply to Re: To Moose or not To Moose.. ?
by Your Mother
in thread To Moose or not To Moose.. ?
by PerlSufi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |