use MooseX::Params::Validate; use MooseX::Types::Moose qw{ ArrayRef Int }; use MooseX::Types::Structured qw{ Dict }; use MooseX::Types::Common::Numeric qw{ PositiveInt PositiveOrZeroInt }; use MooseX::Types::Common::String qw{ NonEmptyStr }; sub some_method { my ($self, $channel_id, $some_array_of_structs) = validated_list( \@_, channel_id => { isa => PositiveInt }, channel_name => { isa => NonEmptyStr }, some_array_of_structs => { isa => ArrayRef[ Dict[ some_id => PositiveInt, quantity => PositiveOrZeroInt, cruciality => Int ] ] } ); # ... }
A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.
Jump to
Parameter checking Perl
Labels:
data,
moose,
parameters,
perl,
validation