in reply to Building modules, my mental block

I believe you can leave the module as is and just call it differently as well; maybe somebody can verify this. Note: This is no longer a Class method you are calling. You are simply calling a sub routine in a different namespace. Example (notice the double colon before auth):
my $auth = Mymodules::Auth::auth($username, $passwd);
I didn't have time to test this code, so I don't know if it is syntactically correct.

Replies are listed 'Best First'.
Re: Re: Building modules, my mental block
by Errto (Vicar) on Apr 20, 2004 at 02:22 UTC

    That is correct. You should use :: and not -> if you want to invoke a subroutine directly, and not as a class method. If you want to invoke it as a class method, you'll need to handle the extra parameter as described above

    However, I think the error you're getting is generated by the line my $username = STDIN; As written, that statement attempts to call a (nonexistent) subroutine called STDIN. What you probably meant was my $username = <STDIN>; or even  my $username = <>; which reads a line from a filehandle