Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Rate It Problem: Param Unblessed Reference

Quote Reply
Rate It Problem: Param Unblessed Reference
I have tried to get the rate.cgi to work and I keep getting the following error message:

Code:

Can't call method "param" on unblessed reference at ../Links/HTML_Templates.pm line 1323.


Line 1323 in the HTML_Templates.pm is as follows:

Code:

my $template = defined $dynamic ? $dynamic->param('t') : undef;


in the sub site_html_rate_form routine.

When I test the script via telnet, I get the following error message:

Code:

[Sun Jul 23 16:47:16 2000] rate.cgi: Use of uninitialized value at rate.cgi line
51.


Line 51 in the rate.cgi is as follows:

Code:

elsif ($in->param('ID') =~ /^\d+$/) {


I have made no changes to the script. I tested the External Rate Mod and the Ratings were added to the Rate_Track and Build_Update tables, HOWEVER, I got the same param error above and the success screen never showed.

I am linking the rate.cgi as follows in my link.html template file:

Code:

<a href="<%build_rate_url%>?ID=<%ID%>">


Keep in mind that I have defined <%build_rate_url%> in the Links.pm as follows:

Code:

$LINKS{build_rate_url} = $LINKS{db_cgi_url} . "/rate.cgi";


And then in the HTML_Templates.pm, I have added this as a global variable.

However, this is not causing the problems. The problem seems to be with the rate.cgi script.

Any thoughts about how to fix these errors?

I did search the forum and I saw unblessed reference errors associated with the search.cgi script, but not the rate.cgi script.

TIA.

Regards,

Eliot Lee

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
Ok, just taking a stab at this, you are trying to use "param" on a non-cgi object.

If you've assigned the cgi object to $in, then use $in->{} to reference the object, not "param()"

I've hit this several times, and that usually has been the fix.

param() is a function of the cgi.pm module that allows operation on the passed parameters.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
Thanks for the response, pugdog. Although if I understand how the rate.cgi works...ID is a parameter that is passed from the links in the categories and in the search results.

Again...I have not edited any of the rate subs in the HTML_Templates.pm or the rate.cgi file.

I did test your suggestions by using $in->{'ID'} and $in{'ID'} and what happened is that I was redirected to the Home Page based on the following codes:

Code:

else {
$dynamic ?
print $in->redirect ("$LINKS{db_cgi_url}/page.cgi") :
print $in->redirect ($LINKS{build_root_url});
}


Any other suggestions are welcome.

TIA.

Regards,

Eliot Lee

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
have you done a compare between your rate.cgi and the rate.cgi in the archive?

Check to see if you inadvertantly changed something, or if you can see why you are getting the 'unblessed' error.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
Welp...I figured it out..The problem was that the script was choking with the $title_linked variable. I changed the following codes:

Code:

$rec ? &site_html_rate_form ($rec, $dynamic) : &site_html_rate_failure ({ error => "Unkown Link ID: " . $in->param('ID') }, $dynamic);


to the following:

Code:

if ($rec) {
my $title_linked = &build_linked_cgi_title ("Rate Site");
&site_html_rate_form ({title_linked => $title_linked, %$rec}, $dynamic);
}
else {
my $title_linked = &build_linked_cgi_title ("Rate Site/Error: Unable to Process Form");
&site_html_rate_failure ({ error => "Unkown Link ID: " . $in->param('ID'), title_linked => $title_linked}, $dynamic);
}


By putting the $rec variable into the hash, the script worked.

Thanks again for your support though. I appreciate it!

Regards,

Eliot

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
ehehe..

eliot.. i'm guessing you are trying to get used to strict and CGI.pm ? :)

ok.. based on that line i could tell you this..

$dynamic is defined..

unfortunately it is not what it is suppose to be.. i'm guessing you modded some line that points to the site_html_rate_form..

look for.. &site_html_rate_form([something], $dynamic); in rate.cgi..

now look for where the scalar $dynamic is defined..

ie.. my $dynamic = blah..

it think it is.. my $dynamic = $in->param('d') ? $in : undef;

this should be below my $in = new CGI; in sub main..

if that is right.. then the value of $dynamic should be right.. unless of course the value of $in is wrong..

which seems like it becuase of your $in->param thing..

all the other scripts run fine? maybe wrong perl path on that file..

Jerry Su
Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
aww man.. once again burned by eliot.. ;)


Jerry Su
Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
Thanks for your suggestion, jerry. And yes, I am getting accustomed to strict and CGI.pm...actually..a lot easier than standard Perl...and on the other hand, a lot more frustrating in terms of slightly different logic.

I have been able to upgrade about 40% of my Mods so far...however, I have not tackled the more difficult Mods, which may take me awhile...I was thinking of waiting until the next version is released...yet since it won't be stable until probably late August or early September...I can't wait that long...so, I have dug into the 1.11 codes.

Wink

Regards,

Eliot

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
The problem with the next release, is that it will probably be as major an upgrade as going from 2.0 to sql, though standard sites should upgrade pretty easily.

I've taken some time to try to understand mod_perl and apache a bit better, and work out some things that have been bugging me in OOP with perl.

I've run out of nails to bite waiting.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
I understand that, pugdog...but at least this will give me a chance to play with the codes and see what I can come up with...and the Mods I am working are basically reading data from and writing to the tables. Nothing too fancy...at this point.

Wink

Regards,

Eliot

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
My concern is with the rewrite of the SQL engine, that many of the calling paramters/procedures will change. That has always happened to me in a 1.0 to 2.0 type of release, and less drastic in future releases (unless the product makes a major jump from one logic to the next ...like Links 2.0 to SQL, or 16-bit to 32-bit, etc).

It seems that what is learned in the 1.0 release is incorporated into the next release, and the shortcomings of the original implementation are easier to rewrite than to work around. It makes for better code, but it means that source code compatibility is diminished.

I've been doing this since about 1983, maybe earlier, so I've hit it in a dozen different languages and hundreds of products and implementations.

I'm just hesitant from past experience.

At my age, I'd rather wait, and see, than rush forward. 10 years ago, I admit, I'd have handled this quite differently, and perhaps even taken it in a completely different (and of course incompatible) direction. I'm more concerned with compatibility and standards today, working with existing (and actively maintained) components rather than building my own.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Rate It Problem: Param Unblessed Reference In reply to
i never really cared how big an upgrade they are..

when an upgrade comes out.. or like when i changed from links2 to links sql i just start from scratch.. everytime.. i just delete my old files and start over.. heheh.. waste of time ya i know.. even links 1.1 to 1.11.. took me 20 minutes to get back together.. and then a week to make another new review.cgi.. each time the coding does get better.. sometimes a little.. sometimes a lot..

if you've noticed.. in the year i've been around i never opened my own site.. :)

in the beginning i had everything going so steadily i actually thought i could open the site before school.. until i started getting requests to make programs for other sites.. that is still going on now..

to date.. i've made approximately 56 sites.. maybe 1/3 are links sql or links 2.. the rest were custom programs.. i don't do HTML.. just the perl.. javascript.. and before Links .. i had a regular kid bank account.. about $1100.. now.. that is in the $16000 range.. i now have 1 CD.. and 2 bank accounts.. it is little money to you big people.. but to a kid.. 14900.. divide that by minimum wage. :).. 7.00 in my area.. is 2129 hours.. 266 eight hour work days.. unfortunately kids can't work that much because of school... they can only make around $5040.. a YEAR..

of course i spent a lot of it buying myself stuff.. new computer.. pocket pc.. a new bed set.. mattress and frame and stuff cause i've been sleeping on the same bed since i was 3.. you jump on it and you can hear springs breaking.. eheh.. ohboy.. i upgraded my pewny cd tape recorder to a sony 5cd 300watt digital tuner 2 tape video md recorder mini shelf system w/ 2 powered subwoofers.. hehe.. i waste too much money.. but as a kid.. you have a lot of wants..

i plan on continuing web programming.. unfortunately.. not with perl.. starting soon i will be doing things in java.. java servelets will probably replace perl in my life..

i'm trying to start early with programming.. because i can get the college credits now.. as i already have a total of 10. .hehe that is like 1 class in my freshmen year of college that i don't need to take anymore..

i'm still not sure if i want to major in computer science.. i rather get a masters in business administration and do something related to marketing..

Jerry Su