The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

args - argument validation for you

SYNOPSIS

  use args;

  sub func2 {
    args my $p => 'Int',
         my $q => { isa => 'Int', optional => 1 };
  }
  func2(p => 3, q => 4); # p => 3, q => 4
  func2(p => 3);         # p => 3, q => undef

  sub func3 {
    args my $p => {isa => 'Int', default => 3},
  }
  func3(p => 4); # p => 4
  func3();       # p => 4

  package F;
  use Moose;
  sub method {
    args my $self,
         my $p => 'Int';
  }
  sub class_method {
    args my $class,
         my $p => 'Int';
  }

  my $f = F->new();
  $f->method(p => 3);

  F->class_method(p => 3);

DESCRIPTION

args is yet another argument validation library. This module makes your module more readable, and writable =)

TODO

coercion support?

AUTHOR

Tokuhiro Matsuno <tokuhirom slkjfd gmail.com>

SEE ALSO

Params::Validate

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.