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

Showing Links on Forum pages

Quote Reply
Showing Links on Forum pages
I wasn't sure where to post this but it seems to be a problem with Links so I've chosen here.

I've had an annoying error message for months and having decided to investigate it properly I think I can replicate it now. I have a Forum application that pulls data from Links. I have a global in Forum:

sub {
my $cat_db = GT::SQL->new('/path/to/links/admin/defs')->table('Category');
}


- obviously the global is more complicated than this but I've identified that this is the line causing the problem.

The problem only occurs the first time that the page is viewed after mod_perl is restarted.

This is the error:

A fatal error has occurred:
Can't call method "table" on an undefined value at /path/to/links/admin/Links/Table/Category.pm line 39.

Please enable debugging in setup for more details.

This is code that is only run for the first time a Category table object is created which is why it only happens after mod_perl is restarted. Is it a bug? Or should I be coding it differently?
Quote Reply
Re: [afinlr] Showing Links on Forum pages In reply to
Hi,

Mm.. not sure. I tend to use a custom routine in scripts that need to "connect" to multiple instances of GLinks/GForum/GCom etc;

Code:
sub loadConnection {

my $path = $_[0];
my $NEWDB = new GT::SQL (
def_path => $path,
cache => 0,
debug => $_[1] || 0,
subclass => 1
);

return $NEWDB;

}

..although this should work better in your case:

Code:
my $NEWDB = new GT::SQL (
def_path => $path,
cache => 0,
debug => 0,
subclass => 1

);
my $cat_tbl = $NEWDB->table('Category');

Not sure if this formatting helps in your instance?

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!

Last edited by:

Andy: Mar 27, 2007, 1:33 AM
Quote Reply
Re: [Andy] Showing Links on Forum pages In reply to
Hi Andy,

Thanks a lot for the reply. I'll try that now and let you know if it fixes it.

Thanks,
Laura.
The UK High Street
Quote Reply
Re: [Andy] Showing Links on Forum pages In reply to
Unfortunately not - exactly the same error.
Quote Reply
Re: [afinlr] Showing Links on Forum pages In reply to
Mmm... couldn't be due to a "lag" in the service doing a full reboot? If not, I'm afraid I'm out of ideas, sorry Unsure

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: [afinlr] Showing Links on Forum pages In reply to
Can you try turning debug on? Try:
Code:
my $links_DB = GT::SQL->new(def_path => '/path/to/links/admin/defs', debug => 3);

And then check your logs to see how it loads (take a look at GT/SQL.pm sub new to see what it should output).

Adrian
Quote Reply
Re: [brewt] Showing Links on Forum pages In reply to
I think it all looks fine until the last but one line:

Code:

GT::Config (9283): Received '/path/to/admin/defs/database.def' for the file to load at /path/to/admin/GT/Config.pm line 139.
GT::Config (9283): Loading '/path/to/admin/defs/database.def' with options: inheritance => '0', local => '0', cache => '1', create_ok => '1', empty => '0', chmod => '438', strict => '0', debug => '3', compile_subs => '' at /path/to/admin/GT/Config.pm line 145.
GT::Config (9283): Header: '# Database access & configuration file
# Last updated: [localtime]
# Created by GT::SQL $Revision: 1.111 $
' at /path/to/admin/GT/Config.pm line 146.
GT::Config (9283): Not loading '/path/to/admin/defs/database.def' from cache at /path/to/admin/GT/Config.pm line 163.
GT::Config (9283): Reason: Not in regular cache at /path/to/admin/GT/Config.pm line 166.
GT::Config (9283): do()ing '/path/to/admin/defs/database.def' at /path/to/admin/GT/Config.pm line 361.
GT::Config (9283): Adding '/path/to/admin/defs/database.def' to the regular cache at /path/to/admin/GT/Config.pm line 177.
GT::SQL (9283): OBJECT CREATED at /path/to/admin/GT/SQL.pm line 160.
GT::SQL (9283): Creating new table object for Category at /path/to/admin/GT/SQL/Base.pm line 114.
GT::SQL::Table (9283): Loading state for Category at /path/to/admin/GT/SQL/Table.pm line 181.
GT::Config (9283): Received '/path/to/admin/defs/Category.def' for the file to load at /path/to/admin/GT/Config.pm line 139.
GT::Config (9283): Loading '/path/to/admin/defs/Category.def' with options: inheritance => '0', local => '0', cache => '1', create_ok => '0', empty => '0', chmod => '438', strict => '0', debug => '3', compile_subs => '' at /path/to/admin/GT/Config.pm line 145.
GT::Config (9283): Header: '# Database definition file for 'Category' table
# Last updated: [localtime]
# Created by GT::SQL::Table $Revision: 1.255 $
' at /path/to/admin/GT/Config.pm line 146.
GT::Config (9283): Not loading '/path/to/admin/defs/Category.def' from cache at /path/to/admin/GT/Config.pm line 163.
GT::Config (9283): Reason: Not in regular cache at /path/to/admin/GT/Config.pm line 166.
GT::Config (9283): do()ing '/path/to/admin/defs/Category.def' at /path/to/admin/GT/Config.pm line 361.
GT::Config (9283): Adding '/path/to/admin/defs/Category.def' to the regular cache at /path/to/admin/GT/Config.pm line 177.
GT::SQL::Table (9283): State loaded for Category at /path/to/admin/GT/SQL/Table.pm line 201.
GT::SQL::Table (9283): Table 'Category' object created. at /path/to/admin/GT/SQL/Table.pm line 101.
Links::Table::Category (9283): Table 'Category' object created. at /path/to/admin/GT/SQL/Table.pm line 101.
GT::SQL (9283): Destroyed GT::SQL=HASH(0xbcac890) in package ModPerl::RegistryCooker at /perl/5.8.5/i386-linux-thread-multi/ModPerl/RegistryCooker.pm line 204. at /path/to/admin/GT/Base.pm line 102.
[Wed Mar 28 09:54:35 2007] [error] Can't call method "table" on an undefined value at /path/to/admin/Links/Table/Category.pm line 39.\n