In Regexp::NamedCaptures, I wrote this snippet so that P::V would be used if it was available and dummied up into place if it wasn't. I have half a mind to make that become a P::V::Fake and just include that with the distribution tarballs of my modules. My Build.PL recommends P::V and my Makefile.PL is silent on the matter.
BEGIN {
eval {
require Params::Validate;
Params::Validate->import( 'validate_pos',
'SCALAR',
'UNDEF',
'CODEREF' );
};
if ( $@ ) {
eval( 'sub validate_pos (\@@) { @{$_[0]} }'
. 'sub SCALAR () { 0 }'
. 'sub UNDEF () { 0 }'
. 'sub CODEREF () { 0 }' );
}
}