Skip to content

Instantly share code, notes, and snippets.

@xenoterracide
Last active December 17, 2015 17:59
Show Gist options
  • Select an option

  • Save xenoterracide/5649931 to your computer and use it in GitHub Desktop.

Select an option

Save xenoterracide/5649931 to your computer and use it in GitHub Desktop.
Interface example
Package Interface::Create;
use Moose::Role;
use Type::Params qw( compile );
use Types::Standard qw( slurpy HashRef);
around create => sub {
my $orig = shift;
my $self = shift;
state $check = compile( slurpy HashRef );
my ( $obj_args ) = $check->( @_ );
return $self->$orig( $obj_args );
};
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment