1#!/usr/bin/perl -w 2 3use strict; 4 5use Params::Validate qw(validate); 6use Test::More tests => 2; 7 8{ 9 my @p = ( foo => 1 ); 10 11 eval 12 { 13 validate( @p, 14 { foo => { type => 'SCALAR' } }, 15 ); 16 }; 17 18 like( $@, qr/\QThe 'foo' parameter ("1") has a type specification which is not a number. It is a string - SCALAR/ ); 19} 20 21{ 22 my @p = ( foo => 1 ); 23 24 eval 25 { 26 validate( @p, 27 { foo => { type => undef } }, 28 ); 29 }; 30 31 like( $@, qr/\QThe 'foo' parameter ("1") has a type specification which is not a number. It is undef/ ); 32 33} 34