bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
And what I would like to do...#!/usr/bin/perl -T print "Content-type: text/html\n\n"; use lib "/home/wbc/www/perllib"; use warnings; use Validate; use strict; use CGI; my $query = new CGI; my $age = Validate->numbers ($query->param('age')); push @errors, "Please, use only numbers.\n" unless $age; __END__ package Validate; sub numbers { my ($class, $value) = @_; return unless $value =~ /^([0-9 \.-]*)$/; return "$1"; } 1;
#!/usr/bin/perl -T print "Content-type: text/html\n\n"; use lib "/home/wbc/www/perllib"; use warnings; use Validate; use strict; use CGI; my $query = new CGI; my $age = Validate->numbers ($query->param('age')); push @errors, $msg unless $age; #something like this but know + it's not correct __END__ package Validate; sub numbers { my ($class, $value) = @_; my $msg = "Please, use only numbers."; return unless $value =~ /^([0-9 \.-]*)$/; return "$1"; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing a value from a module
by saintmike (Vicar) on Apr 14, 2004 at 20:43 UTC | |
|
Re: Passing a value from a module
by revdiablo (Prior) on Apr 14, 2004 at 21:25 UTC | |
|
Re: Passing a value from a module
by sgifford (Prior) on Apr 15, 2004 at 02:33 UTC | |
|
Re: Passing a value from a module
by Stevie-O (Friar) on Apr 14, 2004 at 21:51 UTC | |
|
Re: Passing a value from a module
by qq (Hermit) on Apr 14, 2004 at 22:15 UTC | |
by bradcathey (Prior) on Apr 15, 2004 at 13:42 UTC | |
by qq (Hermit) on Apr 15, 2004 at 19:58 UTC |