December 2012 Archives


Subroutines that take more than a single argument should really be using something like MooseX::Params::Validate.


sub vivisect { 
my ( $self, $args ) = @_;
confess 'Expected a hashref of arguments' unless 'HASH' eq ref $args;

my $hamster = $args->{hamster};

OK, so we know it accepts a hashref of arguments, and what's more, we know one of them is called hamster. But: what constitutes an acceptable hamster? What do we want to …

About Peter Sergeant

user-pic I blog about Perl.