Skip to content
Create a gist now

Instantly share code, notes, and snippets.

only accept hashrefs as arguments #moose #perl
{ package Foo;
use Moose;
has bar => qw( is ro required 1 );
around BUILDARGS => sub {
my ( $orig, $class, @args ) = @_;
unless ( @args == 1 && ref $args[0] eq 'HASH' ) {
die "arguments must be a hash reference";
return $class->$orig(@args);
no Moose;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.