$req is already a reference but you called isPresent using the following
syntax

isPresent(\$req,$user)          # Wrong

instead of 

isPresent($req,$user)           # Correct

On Thu, Aug 16, 2001 at 11:32:39AM -0500, David Simcik shaped the electrons to read:
> 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]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to