NAME

Test::Proto::CodeRef - Test Prototype for CodeRefs.

SYNOPSIS

Test::Proto::CodeRef->new->ok(sub{}); # ok
Test::Proto::CodeRef->new->ok(undef); # not ok

This is a test prototype which requires that the value it is given is defined and is a a CodeRef. In addition to methods inherited from Test::Proto::Base, it provides the try_run method.

METHODS

try_run

pCr->try_run([42], 43)->ok(sub{return $_[0]+1;});

Passes the contents of the first arrayref as arguments to the coderef, evaluating it in scalar context and comparing it to the second value (which will be upgraded).

OTHER INFORMATION

For author, version, bug reports, support, etc, please see Test::Proto.