On 5/24/2010 11:01 AM, Jonathan Swartz wrote:

> Check out Params::Validate or MooseX::Params::Validate.

Thanks for your replies. I think I will go for something like the below:

<%args>
$size 
</%args>

<%init>
my @allowed_sizes = qw (small medium large);  # list of allowed values 

use Params::Validate qw(:all);

my @_args = %ARGS;
validate(
  @_args,
  {
    size => {
      mandatory => 1,
      type      => SCALAR,
      callbacks => { 'check_size' => sub { grep { $size eq $_ } @allowed_sizes; 
} }
    },
);

Best regards,
Andreas
-- 

                                          
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
------------------------------------------------------------------------------

_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to