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
In reply to Building modules, my mental block by neilwatson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |