Why not adopt me?
NAME
Sub::MicroSig - microsigs for microvalidation of sub arguments
VERSION
version 0.01
$Id: MicroSig.pm 126 2005-12-23 05:21:04Z rjbs $
SYNOPSIS
use Sub::MicroSig;
sub pow :sig($x $pow; $trunc) {
my $arg = shift;
my $value = $arg->{x} ** $arg->{pow};
$value = int $value if $arg->{trunc};
}
...
pow({ pow => 2, x => 4 }); # 64
pow([ 2, 0.5, 1 ]); # 1 # int(sqrt(2))
DESCRIPTION
This module allows you to give subroutine a signature using Params::Validate::Micro.
USAGE
To provide a signature to a subroutine, provide the attribute :Sig()
, enclosing in the parentheses a valid Params::Validate::Micro argument string.
The routine will be wrapped so that its parameters are rewritten into the result of calling micro_validate
on its passed arguments. If more than one argument is passed, or if the one passed argument is not an array or hash reference, an exception is thrown by Sub::MicroSig.
The the given arguments cannot be validated according to the micro-argument string, Params::Validate throws an exception.
AUTHOR
Ricardo Signes, <rjbs@cpan.org>
BUGS
Please report any bugs or feature requests to bug-sub-microsig@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SEE ALSO
COPYRIGHT
Copyright 2005 Ricardo Signes, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.