Last active
December 17, 2015 17:59
-
-
Save xenoterracide/5649931 to your computer and use it in GitHub Desktop.
Interface example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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