Benchmark-Featureset-ParamCheck

 view release on metacpan or  search on metacpan

lib/Benchmark/Featureset/ParamCheck/Implementation/PV.pm  view on Meta::CPAN

use parent qw(Benchmark::Featureset::ParamCheck::Base::PV);
use Params::Validate 1.26 qw(:types);
use namespace::autoclean;

use constant long_name => 'Params::Validate';
use constant short_name => 'PV';

sub get_named_check {
	state $check = {
		integer   => { type => SCALAR,   regex => qr/\A-?[0-9]+\z/ },
		hashes    => { type => ARRAYREF, callbacks => { hashes => sub { !grep ref ne 'HASH', @{$_[0]} } } },
		object    => { type => OBJECT,   can => [qw/print close/] },
	};
}

sub get_positional_check {
	state $check = [
		{ type => SCALAR,   regex => qr/\A-?[0-9]+\z/ },
		{ type => ARRAYREF, callbacks => { hashes => sub { !grep ref ne 'HASH', @{$_[0]} } } },
		{ type => OBJECT,   can => [qw/print close/] },
	];
}

1;

lib/Benchmark/Featureset/ParamCheck/Implementation/PV/TypeTiny.pm  view on Meta::CPAN

use Ref::Util::XS 0.116 ();
use Types::Standard 1.001_009 -types;
use Type::Tiny::XS 0.012 ();
use namespace::autoclean;

use constant long_name => 'Params::Validate with Type::Tiny';
use constant short_name => 'PV-TT';

sub get_named_check {
	state $check = {
		integer   => { callbacks => { typecheck => (Int)->compiled_check } },
		hashes    => { callbacks => { typecheck => (ArrayRef[HashRef])->compiled_check } },
		object    => { callbacks => { typecheck => (HasMethods[qw/ print close /])->compiled_check } },
	};
}

sub get_positional_check {
	state $check = [
		{ callbacks => { typecheck => (Int)->compiled_check } },
		{ callbacks => { typecheck => (ArrayRef[HashRef])->compiled_check } },
		{ callbacks => { typecheck => (HasMethods[qw/ print close /])->compiled_check } },
	];
}

1;



( run in 0.643 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )