neilwatson has asked for the wisdom of the Perl Monks concerning the following question:
I present to you a basic concept of what I would like:
The module:# this is properly placed where perl can find it use Mymodules::Auth; use strict; use warnings; print "Username: "; my $username = STDIN; chomp $username; ReadMode('noecho'); print "Password: " my $passwd = STDIN; chomp($passwd); ReadMode('restore'); # somehow pass $username and $password to # Mymodules::Auth and the subroutine auth # this will return 0 or 1. my $auth = Mymodules::Auth->auth($username, $passwd);
package Mymodules::Auth; use strict; use warnings; sub auth { my $username = shift @_; my $passwd = shitf @_; # here I would use DBI to get the password # and username from a database . . . if ($db-passwd eq $passwd){ $auth = 1; return $auth; }else{ $auth = 0; return $auth; } } 1;
I've tried following examples but, it just does not seem clear to me how to go about this. No matter what I do, I always get an error similar to "Undefined subroutine..."
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Building modules, my mental block
by jeffa (Bishop) on Apr 19, 2004 at 20:12 UTC | |
|
Re: Building modules, my mental block
by chromatic (Archbishop) on Apr 19, 2004 at 20:00 UTC | |
by neilwatson (Priest) on Apr 19, 2004 at 20:19 UTC | |
by chromatic (Archbishop) on Apr 19, 2004 at 21:07 UTC | |
by neilwatson (Priest) on Apr 19, 2004 at 20:05 UTC | |
|
Re: Building modules, my mental block
by disciple (Pilgrim) on Apr 19, 2004 at 21:35 UTC | |
by Errto (Vicar) on Apr 20, 2004 at 02:22 UTC |