Gossamer Forum
Home : General : Perl Programming :

Can't call method "param" on an undefined value

Quote Reply
Can't call method "param" on an undefined value
Hiya guys/gals. I have a bit of a weird problem here. Basically, I added this code into /Links/Build.pm;

Code:
my $domains;
$domains->{'domain1'} = 'http://www.domain1.co.uk/';
$domains->{'domain2'} = 'http://www.domain2.co.uk/';

# don't bother editing this...
my $_s = $IN->param('s') || 'domain1';
my $__set = $domains->{$_s};

... but now I get the following error;

Quote:
Can't call method "param" on an undefined value at /home/cgi-bin/admin/Links/Build.pm line 34.
Compilation failed in require at /home/cgi-bin/admin/Links/User/Search.pm line 19.
BEGIN failed--compilation aborted at /home/cgi-bin/admin/Links/User/Search.pm line 19.
Compilation failed in require at /home/cgi-bin/search.cgi line 18.
BEGIN failed--compilation aborted at /home/cgi-bin/search.cgi line 18.

Anyone got any ideas why this may be?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can't call method "param" on an undefined value In reply to
BTW, I have this at the top of Build.pm, which *should* give me access to $IN;

Code:
use Links qw/$DB $IN $CFG/;

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Can't call method "param" on an undefined value In reply to
Hi Andy,

the code looks fine to me and works if you put it in a single .cgi-file.
What happens if you add

Code:
use CGI;
my $IN = new CGI;


at the beginning of the subroutine - any changes? (which should not be the case) Crazy

Regards

Niko
Quote Reply
Re: [el noe] Can't call method "param" on an undefined value In reply to
It works fine. I tried this already, I added;

use CGI;
my $_IN = new CGI;

.. and then use $_IN->parram() to call it.

I'm getting the code to re-start mod_perl too later, as I have a feeling this may be part of the problem.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!