Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Problem with user-scripts from Links-SQL 2.1 Beta1 in Beta2

Quote Reply
Problem with user-scripts from Links-SQL 2.1 Beta1 in Beta2
Hello,

Who can tell me the major difference in the code, and how to solve the difference.

If I use user scripts from Links-SQL 2.1 Beta 1 in Beta 2, I get the following error message:


Can't use string ("1") as a subroutine ref while "strict refs" in use at /opt/guide/www.ridesworld.com/cgi-bin/links/admin/GT/Plugins.pm line 102.


who can give me a clear solution ???

Quote Reply
Re: [ridesworld] Problem with user-scripts from Links-SQL 2.1 Beta1 in Beta2 In reply to
That's an error you get when you try to use a HASH in a SCALAR context (I think, or vice versa).

At any rate , those errors showed up in the change over from 1x to 2x and they were based on the return values of functions changing from a HASH to a HASH_REF (scalar).

That might direct you.

Also.... depending on the scripts, there were certain changes in Links, that were "fixed" by Alex because of these errors. You might want to check _old_ messages (begining of the Discussions Forum for some other ideas).






PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Problem with user-scripts from Links-SQL 2.1 Beta1 in Beta2 In reply to
Hello

I think there is a small problem with GT::Plugins

if i do this for example in my .cgi script:


use strict;
use lib '/path-to/cgi-bin/admin';
use Links qw/$DB $IN $USER $CFG/;
use Links::User::CatRecommend;
Links::reset_env( { load_user => 1 } ) if ($Links::PERSIST);

local $SIG{__DIE__} = \&Links::fatal;
if (Links->check_request()) {
GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'handle_catrecommend', \&Links::User::CatRecommend::handle);
}

everything works fine.

if i do

use strict;
use lib '/opt/guide/www.ridesworld.com/cgi-bin/links/admin';
use Links qw/$DB $IN $USER $CFG/;
use Links::User::CatRecommend;
Links::reset_env( { load_user => 1 } ) if ($Links::PERSIST);

local $SIG{__DIE__} = \&Links::fatal;
if (GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'check_request', &Links::check_request)) {
GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'handle_catrecommend', \&Links::User::CatRecommend::handle);
}

I get the error message.



Quote Reply
Re: [ridesworld] Problem with user-scripts from Links-SQL 2.1 Beta1 in Beta2 In reply to
You don't need to load $USER, $IN or $DB as far as I can see.

Your original example can't have worked due to:

use lib '/path-to/cgi-bin/admin';



Last edited by:

PaulW: Dec 18, 2001, 1:34 PM
Quote Reply
Re: [ridesworld] Problem with user-scripts from Links-SQL 2.1 Beta1 in Beta2 In reply to
Hi,

The problem is with:

if (GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'check_request', &Links::check_request)) {

You have &Links::check_request, when you need \&Links::check_request. You are missing the backslash.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Problem with user-scripts from Links-SQL 2.1 Beta1 in Beta2 In reply to
hello,

Thank you, it was indeed that backslash.