Skip to main content
Add a code exampleAdd a link and an example
Source Link
smonff
  • 3.5k
  • 4
  • 40
  • 49

Your way is more than adequate.

You can also create enums with Moose::Util::TypeConstraintsMoose::Util::TypeConstraints, if you happen to be using Moose. (Which you should be.)

use Moose::Util::TypeConstraints;

has 'phone_number' => (
    is  => 'ro',
    isa => enum([qw/ Home Work Mobile /]),
);

Your way is more than adequate.

You can also create enums with Moose::Util::TypeConstraints, if you happen to be using Moose. (Which you should be.)

Your way is more than adequate.

You can also create enums with Moose::Util::TypeConstraints, if you happen to be using Moose. (Which you should be.)

use Moose::Util::TypeConstraints;

has 'phone_number' => (
    is  => 'ro',
    isa => enum([qw/ Home Work Mobile /]),
);
Source Link
jrockway
  • 42.9k
  • 10
  • 65
  • 87

Your way is more than adequate.

You can also create enums with Moose::Util::TypeConstraints, if you happen to be using Moose. (Which you should be.)