https://github.com/gfx/p5-Data-Validatorã大ä½ã§ããã®ã§ãªãªã¼ã¹ãã¾ããã åºæ¬çã«ã¯ååã§å¼æ°ãæå®ããé¢æ°åãã§ãããã¡ã½ããç¨ã«å¯¾å¿ããããªã¹ãã¹ã¿ã¤ã«ã§å¼æ°ãæå®ãããããæ¡å¼µæ©è½ãããã¾ãã ã¾ãã$validator->with('Method') ã§ã¡ã½ããç¨ã«ãªãã¾ãããã ãã第ä¸å¼æ°ã®åã¯ãã¾ã®ã¨ããæå®ã§ãã¾ããï¼ use feature 'state'; use Data::Validator; sub Foo::add { state $rule = Data::Validator->new( a => 'Int', b => 'Int', )->with('Method'); my($self, $args) = $rule->validate(@_); return $args->{a} + $args->{b}; } p
{{#tags}}- {{label}}
{{/tags}}