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

read data from LinkSQL into messenger??

Quote Reply
read data from LinkSQL into messenger??
I'm trying to customize the GForum Messenger system and integrate it with my LinksSQL that is being used as a classifieds system. I want to make it so the when a user clicks a "Contact Member" link in the linksSQL classifieds, they
presented with a customized Messenger window tailored to this communication.

So far I've written a simple plugin for that GForum plucks off additional variables passed to it in the querystring and passes them to the message.html template.

For example:

Code:
http://www.mysite.com/cgi-bin/forum/gforum.cgi?do=message&class=true&ad_id=163

I could pass any additional variables along in the querystring -- but I've always thought that is not very elegant.

I want to write a plugin for GForum that will read in the ad_id, retrieve the value from LinksSQL and display it in the message.html template.

I'm attempting to do it like this with NO luck...

In the GForum message.html template.

Code:
<%Plugins::Classifieds::get_record($ad_id)%>
Remember, my simple plugin is making $ad_id visible in the template.

Then, in gforum/admin/Plugins/ I have the following:

Code:
# ==================================================================
# Plugins::GForum::Classifieds - Auto Generated Program Module
#
# Plugins::GForum::Classifieds
# Author : MP
# Version : 1
# Updated : Tue Feb 1 11:38:55 2005
#
# ==================================================================
#

package Plugins::Classifieds;
# ==================================================================

use strict;
use lib '/htdocs/www/cgi-bin/classifiedsDev/admin';
use GT::Base;
use GT::SQL;
use GT::SQL::Table;
use Links;
use GT::Dumper;
#use GT::Plugins qw/STOP CONTINUE/;
#local $SIG{__DIE__} = \&Links::fatal;
Links::init('/htdocs/www/cgi-bin/classifiedsDev/admin');


# Inherit from base class for debug and error methods
@Plugins::Classifieds::ISA = qw(GT::Base);

# Your code begins here! Good Luck!


# PLUGIN HOOKS
# ===================================================================


sub get_record {
# -----------------------------------------------------------------------------
#

#GT::SQL->reset_env();

my $ad_id = shift;

my $db = new GT::SQL '/htdocs/www/cgi-bin/classifiedsDev/admin/defs';
my $ad_db = $db->table ('Links');

my $ad = $ad_db->select( { ID => $ad_id } )->fetchrow_hashref;

while ( my($key,$value) = each %$ad ){
return { $key => $value };
}

}

# Always end with a 1.
1;

If I run as above I get the following error:

Code:
rror: Unable to load module: Plugins::Classifieds. Reason:
Bareword "MOD_PERL" not allowed while "strict subs" in use at /htdocs/www/cgi-bin/classifiedsDev/admin/Links.pm line 547.
Bareword "MOD_PERL" not allowed while "strict subs" in use at /htdocs/www/cgi-bin/classifiedsDev/admin/Links.pm line 547.
Bareword "SPEEDY" not allowed while "strict subs" in use at /htdocs/www/cgi-bin/classifiedsDev/admin/Links.pm line 548.
Compilation failed in require at /htdocs/www/cgi-bin/forumDev/admin/Plugins/Classifieds.pm line 20.
BEGIN failed--compilation aborted at /htdocs/www/cgi-bin/forumDev/admin/Plugins/Classifieds.pm line 20.
Compilation failed in require at GT::Template::_call_func line 750. ,
Can't locate Plugins.pm in @INC (@INC contains: /htdocs/www/cgi-bin/classifiedsDev/admin /htdocs/www/cgi-bin/forumDev/admin
/usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux
/usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .) at GT::Template::_call_func line 750.

If I comment out "use Links" -- I get this error...

Code:

A fatal error has occurred:
GT::SQL (27635): Unable to load subclass: 'Links::Table::Links' Reason: Bareword "MOD_PERL" not allowed while "strict subs" in use
at /htdocs/www/cgi-bin/classifiedsDev/admin/Links.pm line 547.
Bareword "MOD_PERL" not allowed while "strict subs" in use at /htdocs/www/cgi-bin/classifiedsDev/admin/Links.pm line 547.
Bareword "SPEEDY" not allowed while "strict subs" in use at /htdocs/www/cgi-bin/classifiedsDev/admin/Links.pm line 548.
Compilation failed in require at /htdocs/www/cgi-bin/classifiedsDev/admin/Links/Table/Links.pm line 17.
BEGIN failed--compilation aborted at /htdocs/www/cgi-bin/classifiedsDev/admin/Links/Table/Links.pm line 17.
Compilation failed in require at /htdocs/www/cgi-bin/forumDev/admin/GT/SQL/Base.pm line 575.
, Can't locate Links/Table.pm in @INC (@INC contains: /htdocs/www/cgi-bin/classifiedsDev/admin /htdocs/www/cgi-bin/forumDev/admin
/usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0/i386-linux
/usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.6.1/i386-linux /usr/lib/perl5/vendor_perl/5.6.1 /usr/lib/perl5/vendor_perl .)
at /htdocs/www/cgi-bin/forumDev/admin/GT/SQL/Base.pm line 575.
at /htdocs/www/cgi-bin/forumDev/admin/Plugins/Classifieds.pm line 49.


Please enable debugging in setup for more details.

Beyond that I'm stumped. Should I just bail on this or is there a simple answer...

Many thanks to anyone who can point me in the right direction!!

Mike

Last edited by:

Swaylock: Feb 2, 2005, 11:40 AM