Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Hmm I get this error from $q's

by rob_au (Abbot)
on Jul 15, 2002 at 00:39 UTC ( #181669=note: print w/replies, xml ) Need Help??

in reply to Hmm I get this error from $q's

It looks like you are attempting to validate information passed from form input fields in a CGI script. For this, I would suggest that you might want to look at either HTML::FormValidator or Data::FormValidator - These modules allow for validation of not only the presence of form input fields in the passed CGI parameters, but also the adherence of these fields to allowed formats. For example:

use CGI; use Data::FormValidator; my $cgi = CGI->new; my $validator = Data::FormValidator->new({ 'form_input' => { 'required' => [ qw/ first second clan nick pass repass e +mail reemail street postal city country / ], 'constraints' => { 'email' => 'email', 'pass' => '/^[\w\d\-\ ]{1,}$/', 'reemail' => 'email', 'repass' => '/^[\w\d\-\ ]{1,}$/' }, 'filters' => [ qw/ trim / ] } }); my %params = map { $_ => $cgi->param($_) } $cgi->param(); my ( $valid, $missing, $invalid, $unknown ) = $validator->validate( \% +params, 'form_input' );

This little snippet of code performs a number of tasks:

  • Creates a new CGI object, $cgi.

  • Creates a new Data::FormValidator object with a input validation profile called 'form_input' - This input validation profile defines the required fields and sets regular expression constraints on some of them (email, pass, reemail and repass) which need to be met for the field to be considered as 'valid'.

  • Creates a hash of CGI parameters, indexed by the parameter field name, and,

  • Validates the CGI form input fields with the Data::FormValidator validator against the form_input validation profile - This returns four array references containing those fields which are valid, invalid, missing and unknown respectively.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://181669]
[Corion]: Hi James!
[james28909]: I looked through the docs, and see that PerlApp::exe() is suppose to return this information but whenever i try to use this, i get the error "Undefined subroutine &PerlApp::exe called"
[james28909]: i just want to verify the integrity of the executables name each time it is run.
[Corion]: Weird. this documentation says what you say.
[Corion]: I assume you are experiencing this with your packaged program. Maybe also include in the packaging list?
[james28909]: has anyone else run into this problem? i have tried searching but have not returned many results
[james28909]: ah, good idea.
[Corion]: What does print $PerlApp::VERSION output?

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2017-07-28 13:53 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (429 votes). Check out past polls.