Kalle Hallivuori > Test-CallFlow-0.03 > Test::CallFlow::ArgCheck::Code

Download:
Test-CallFlow-0.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  7
Open  0
View/Report Bugs
Source  

Test::CallFlow::ArgCheck::Code ^

  my $truth = 
    Test::CallFlow::ArgCheck::Code
      ->new( 
        test => sub { 
          my ($self, $at, $args) = @_; 
          ref $args->[$at] =~ $self->{re} 
        }, 
        re => qr/Good/
      )
      ->check( bless {}, 'My::Godness' );

Delegates decision about validity of arguments to associated code reference (sub).

See base class Test::CallFlow::ArgCheck.

FUNCTIONS ^

check

  $checker->check( 1, [ 'foo', 'bar' ] ) ? 'ok' : die;

Checks given argument by calling associated code reference with it.

Arguments passed to called sub are

  0. this ArgChecker object
  1. position of argument to test
  2. reference to array of arguments.

This way the associated sub can be written like a member of this class, using its properties.

syntax highlighting: