Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Exploring Type::Tiny Part 5: match_on_type

by tobyink (Canon)
on Aug 19, 2018 at 18:41 UTC ( [id://1220653] : CUFP . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
       use Types::Standard qw( is_ArrayRef is_HashRef );
       use Carp qw( croak );
       
    ...
             croak "Could not grok data";
          }
       }
    
  2. or download this
       use Types::Standard qw( ArrayRef HashRef Any );
       use Type::Utils qw( match_on_type );
       use Carp qw( croak );
    ...
             HashRef,  sub { $self->_process_value($_) for values %$data }
    +,
             Any,      sub { croak "Could not grok data" };
       }
    
  3. or download this
       use Types::Standard qw( ArrayRef HashRef Any );
       use Type::Utils qw( compile_match_on_type );
       use Carp qw( croak );
    ...
             Any,      sub { croak "Could not grok data" };
          $matcher->($data);
       }
    
  4. or download this
       use Types::Standard qw( ArrayRef HashRef Any );
       use Type::Utils qw( compile_match_on_type );
       use Carp qw( croak );
    ...
             Any,      sub { croak "Could not grok data" };
          $matcher->($data, $self);
       }
    
  5. or download this
       use Types::Standard qw( ArrayRef HashRef Any );
       use Type::Utils qw( compile_match_on_type );
       use Carp qw();
    ...
             Any,      q{ Carp::croak("Could not grok data") };
          $matcher->($data, $self);
       }