IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5253


Ignore:
Timestamp:
Oct 7, 2005, 4:09:05 PM (21 years ago)
Author:
jhoblitt
Message:

add Params::Validate

Location:
trunk/PS-IPP-PSFTP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-PSFTP/Build.PL

    r5252 r5253  
    88    license             => 'gpl',
    99    create_makefile_pl  => 'passthrough',
     10    requires            => {
     11        'Params::Validate'      => '0.77',
     12    },
    1013    build_requires      => {
    1114        'Test::Warn'            => '0.08',
  • trunk/PS-IPP-PSFTP/lib/PS/IPP/PSFTP/Parser.pm

    r5248 r5253  
    11# Copyright (C) 2005  Joshua Hoblitt
    22#
    3 # $Id: Parser.pm,v 1.2 2005-10-08 01:20:12 jhoblitt Exp $
     3# $Id: Parser.pm,v 1.3 2005-10-08 02:09:05 jhoblitt Exp $
    44
    55package PS::IPP::PSFTP::Parser;
     
    88
    99use Carp qw( carp );
     10use Params::Validate qw( validate_pos SCALAR );
    1011
    1112use vars qw( @FIELDS @REQUIRED_FIELDS );
     
    1617sub new
    1718{
    18     my ($class, %parameters) = @_;
     19    my $class = shift;
    1920
    20     my $self = bless ({}, ref ($class) || $class);
     21    validate_pos(@_);
     22
     23    my $self = bless {}, ref ($class) || $class;
    2124
    2225    return $self;
     
    2528sub parse
    2629{
    27     my ($self, $doc) = @_;
     30    my $self = shift;
     31
     32    my ($doc) = validate_pos(@_,
     33        {
     34            type    => SCALAR,
     35            regex   => qr/\S+/, # string with atleast 1 non WS char
     36        }
     37    );
    2838
    2939    # pack data into an HoH
Note: See TracChangeset for help on using the changeset viewer.