NAME

Ambrosia::Assert - adds a validation method in your module.

VERSION

version 0.010

SYNOPSIS

#foo.pm 
use Ambrosia::Assert GLOBAL_KEY => 'debug';

sub foo
{
    my @params = @_;
    assert(sub {@params && $params[0] eq 'abc'}, 'invalid params in foo()');
    .......
}

#script.pl
use foo;
foo::foo();
END
{
    $? = 0 if $?==42;
}

DESCRIPTION

Ambrosia::Assert adds a validation method in your module. You can on or off assert for debug.

USAGE

use Ambrosia::Assert GLOBAL_KEY => 'debug'; #on validation
use Ambrosia::Assert GLOBAL_KEY => 'nodebug'; #off validation

GLOBAL_KEY is any keyword, for example application name.

METHODS

assert( $subroutine, $message )

assert(sub {@params && $params[0] eq 'abc'}, 'invalid params in foo()');

If the $subroutine returns false then application execution will be stopped. In value of variable $? will be 42 and on STDERR will be output the $message.

THREADS

Not tested.

BUGS

Please report bugs relevant to Ambrosia to <knm[at]cpan.org>.

COPYRIGHT AND LICENSE

Copyright (C) 2010-2012 Nickolay Kuritsyn. All rights reserved.

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

AUTHOR

Nikolay Kuritsyn (knm[at]cpan.org)