in reply to Testing Edges

Params::Validate

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Replies are listed 'Best First'.
Re^2: Testing Edges
by thekestrel (Friar) on Mar 29, 2005 at 20:29 UTC
    Dragonchild,
    Thanks for the link, that pretty much looks like exactly what I was after. =)

    Regards Paul
Re^2: Testing Edges
by thekestrel (Friar) on Mar 29, 2005 at 23:15 UTC
    Dragonchild,
    I've been tinkering with it for a while, but don't seem to be having much luck with positional arguments as opposed to named ones. Named parameters seem to be working fine, I just don't seem to do anything, but check for existence of positional arguments.
    Just prior to the 'Dependancies' section on the documentation of the module it says....

    or this for positional parameters: validate_pos( @_, { type => SCALAR }, { type => ARRAYREF, optional => + 1 } ); By default, parameters are assumed to be mandatory unless specified as + optional.
    However, if I enter something like this...
    #!/usr/bin/perl #use strict; use warnings; use Params::Validate; sub func1 { validate_pos( @_, { type => SCALAR} ); print "hi fluffy\n"; } func1("test");
    I get the following...
    Argument "SCALAR" isn't numeric in subroutine entry at ./a.pl line 8. Parameter #1 ("test") to main::func1 was a 'scalar', which is not one +of the allowed types: at ./a.pl line 8 main::func1(3) called at ./a.pl line 13
    Any ideas why this is so? Ideas....?

    Regards Paul
      You need to
      use Params::Validate qw(:types);
      to get the constants used for type checking (the SCALAR in your example).

      Params::Validate docs

      - Espen