I believe that you may need to add an ampersand "&" before the name of the
subroutine, like so:
if(!&isPresent(\$req, $user))
Randy
"David Simcik" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Newbie question here...
>
> I've created a CGI.pm object and want to pass its reference to a function.
> It keeps on puking though, returning this message:
>
> Type of arg 1 to main::isPresent must be scalar (not single ref
constructor)
> at C:\src\Orion\cgi-bin\share.pl line 45, near "$user)"
>
> Basically, I'd like to treat the $req CGI.pm object as just that in the
> function call isPresent(). Maybe not the best use of a reference, but I'm
> hellbent on figuring out this reference thing first! ;-)
>
>
> Here's the offending source (I've left out code for brevity). Please note
> that I have set this function up in prototype form (mostly for
posteirity):
>
> sub isPresent(\$$);
>
> our $req = new CGI();
>
> if(!isPresent(\$req, $user))
> {
>
> print "User not present\n";
> }
> elsif (!isPresent(\$req, $pass))
> {
>
> print "Password not present\n";
> }
> elsif (!isPresent(\$req, $agreed))
> {
>
> print "Agreement not present\n";
> }
>
> sub isPresent(\$$)
> {
>
> my $qref = shift;
> my $paramname = shift;
> my $query = $$qref;
>
> if($query->param($paramname) =~/""/ || !defined
($query->param($paramname))
> {
> #return;
> }
>
> #otherwise...
> return 1;
> }
>
>
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]