Created
November 7, 2010 09:27
-
-
Save gfx/666033 to your computer and use it in GitHub Desktop.
This file contains 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
#!perl -w | |
use strict; | |
use Smart::Args; | |
use MooseX::Types::Structured qw(:all); | |
use MooseX::Types::Moose qw(:all); | |
use Data::Dumper; | |
sub foo { | |
# Tuple()にはカッコが必要(さもないと後続の引数 my $baz を飲み込んでしまうため) | |
args my $bar => Tuple([ Str, Str, Str ]), my $baz; | |
print Dumper([$bar, $baz]); | |
} | |
foo bar => [1, 2, 3], baz => 42; # OK | |
foo bar => [ 10 ], baz => 42; # boom! | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment