Params::Validate::Dummy - Stub for Params::Validate


Module-Optional documentation Contained in the Module-Optional distribution.

Index


Code Index:

NAME

Top

Params::Validate::Dummy - Stub for Params::Validate

SYNOPSIS

Top

  use Params::Validate::Dummy qw();
  use Module::Optional qw(Params::Validate);

DESCRIPTION

Top

This module provides stub routines for those who don't have Params::Validate installed.

For more details, please refer to the documentation for Params::Validate.

The code here is just stub routines which do NOTHING at all, passing through any arguments in the API and prototypes of Params::Validate. In particular, the dummy stubs do not do defaulting, validation, untainting or anything else that Params::Validate does. If you need this functionality, either provide it yourself in the surrounding code, or don't use this module and insist that the real Params::Validate is installed.

validate, validate_pos

The parameter list is passed through as a return value.

validate_with

Returns the value of the params option.

set_options, validation_options

These do nothing at all.

Data types: SCALAR, SCALARREF, ARRAYREF, HASHREF, GLOB, GLOBREF, BOOLEAN, CODEREF, HANDLE, OBJECT, UNDEF, UNKNOWN

In the Params::Validate module, these are constants implemented by subs that return numbers. This module implements the same functions.

SUPPORT

Top

See Module::Optional


Module-Optional documentation Contained in the Module-Optional distribution.

package Params::Validate::Dummy;

use strict;
use warnings;

BEGIN {
	use Exporter ();
	use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
	$VERSION     = 0.03;
	@ISA         = qw (Exporter);
	my %tags =
        ( types =>
          [ qw( SCALAR ARRAYREF HASHREF CODEREF GLOB GLOBREF
                SCALARREF HANDLE BOOLEAN UNDEF OBJECT ) ],
        );

	%EXPORT_TAGS = (
	all => [ qw( validate validate_pos validation_options validate_with ),
                     map { @{ $tags{$_} } } keys %tags ],
	%tags,
	);
	@EXPORT      = qw (validate validate_pos);
	@EXPORT_OK   = (@{ $EXPORT_TAGS{all} }, 'set_options' );
}

sub validate (\@$) {
    @{$_[0]};
}

sub validate_pos (\@@) {
    @{$_[0]};
}

sub validate_with {
    my %p = @_;

    $p{params};
}

sub validation_options {}
sub set_options {}


sub SCALAR    () { 1 }
sub ARRAYREF  () { 2 }
sub HASHREF   () { 4 }
sub CODEREF   () { 8 }
sub GLOB      () { 16 }
sub GLOBREF   () { 32 }
sub SCALARREF () { 64 }
sub UNKNOWN   () { 128 }
sub UNDEF     () { 256 }
sub OBJECT    () { 512 }
sub HANDLE    () { 16 | 32 }
sub BOOLEAN   () { 1 | 256 }

1;

__END__