bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
My external file ('validate.pm'):#!/usr/bin/perl print "Content-type: text/plain\n\n"; use strict; use CGI::Carp qw(fatalsToBrowser); use validate; my $the_time = "12:23 pm"; &val_time( $the_time ); $the_time = $val; if ($the_time) { print "$the_time\n" } else { print "error\n" }
When I run it, I get validate.pm did not return a true value at timeval.pl line 7. No surprise, but what am I missing:#!/usr/bin/perl our $val; sub val_time { $val = shift; $val = ($val =~ /^(\d{2}):(\d{2}) (am|pm)$/) ? "$1:$2 $3" : 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using a subroutine as a module
by The Mad Hatter (Priest) on Nov 02, 2003 at 23:46 UTC | |
|
Re: Using a subroutine as a module
by Roger (Parson) on Nov 02, 2003 at 23:53 UTC | |
|
Re: Using a subroutine as a module
by ysth (Canon) on Nov 03, 2003 at 00:29 UTC | |
by bobn (Chaplain) on Nov 03, 2003 at 02:09 UTC | |
by ysth (Canon) on Nov 03, 2003 at 06:25 UTC | |
by Anonymous Monk on Nov 03, 2003 at 10:12 UTC | |
by bobn (Chaplain) on Nov 03, 2003 at 15:43 UTC | |
|
Re: Using a subroutine as a module
by bradcathey (Prior) on Nov 03, 2003 at 02:11 UTC |