Test::CallFlow::ArgCheck::Code - Test::CallFlow::ArgCheck::Code documentation


Test-CallFlow documentation  | view source Contained in the Test-CallFlow distribution.

Index


Test::CallFlow::ArgCheck::Code

Top

  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

Top

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.


Test-CallFlow documentation  | view source Contained in the Test-CallFlow distribution.