Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Annoying error

Quote Reply
Annoying error
I have an annoying error sometimes when I restart mod_perl. It is actually on Forum pages but where I am pulling the category menu in from Links. The error is

Can't call method "table" on an undefined value at /path to admin/Links/Table/Category.pm line 44

It seems to be that $DB isn't being initialised properly. After this error, it works fine. Doesn't happen everytime, so I guess it must be where the forum page is shown before any Links pages have been shown.

Any ideas how I can stop it from happening?
Quote Reply
Re: [afinlr] Annoying error In reply to
I also had some similar problems with Links::Table::Category and $DB object, in Links SQL v2.2.1.

I found that this code caused me the problems in Links.pm/sub init:
Code:
if ($DB and not ref $DB eq 'GT::Delay') { # $DB is already a GT::SQL object
$DB = GT::SQL->new({
def_path => $CFG->{admin_root_path} . '/defs',
cache => 1,
debug => $debug
});
}
else {
$DB = GT::Delay(
'GT::SQL', 'HASH',
{
def_path => $CFG->{admin_root_path} . '/defs',
cache => 1,
debug => $debug
}
);
}
It happened, that $DB got somehow into the "else" condition leaf, causing to create an empty $DB object.
Note, if you compare Links.pm in v2.1.2 and Links.pm in v2.2.1, you will see that there was quite a few changes, including the code above...

However I did not investigate furthermore, what the problem really was...
Just FYI.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Annoying error In reply to
Thanks for replying - that gives me somewhere to start investigating.