Gossamer Links Help


Table of Contents

Links SQL Developers Guide: Core Files and Variables

Any Gossamer Links script will start out with:

	use strict;
	use lib '/path/to/admin';
	use Links qw/$IN $DB/;
	Links::init ('/path/to/admin');
	Links::init_user(); 

The lines mean:

  • use strict - Required to avoid common mistakes and enforce good programming practices. 
  • use lib '/path/to/admin' - Tells Gossamer Links where it is installed.
  • use Links qw/$IN $DB/; - Loads Gossamer Links and makes $IN and $DB variables available in this script.
  • Links::init ('/path/to/admin'); - Initializes Gossamer Links.
  • Links::init_user(); - Optional, only needed if this is a user side script. It loads the current user into $USER.

The variables available for use are:

$IN A GT::CGI object, stores all the form input and behaves very close to CGI.pm
$DB A GT::SQL object. This is used to access and store any data Gossamer Links needs.
$CFG The Links SQL Config file. It's a hash of all the configuration options used.
$USER A hash of the currently authenticated user. If Gossamer Links is unable to authenticate the user, then this variable will be undefined.

These objects are globals and will be automatically imported into your namespace.

The following is a summary of what the main modules in Gossamer Links do:

Links.pm Contains the main code to initilze the globals needed, plus very commonly used routines like page parsing, and error handling.
Links::Authenticate Contains code used to modularize the user system. If you are looking at making Gossamer Links share a common user base with another program, then this is the area you want to change.
Links::Browser Contains code to manage the category browser.
Links::Build Contains code to do the calculations neccessary to build a section of Links. i.e. calculation neccessary to get a list of What's New links. Does not actually build the final html, just returns a hash of template variables.
Links::Config Contains code to manage your config file. Provides methods to load, save and alter your config file.
Links::Config::Data Stores just the hash of your current config options. This gets parsed everytime a new config object is created.
Links::HTML::Category This is a subclass of GT::SQL::Display::HTML::Table which contains code used when displaying a category in the admin panel.
Links::HTML::Links This is a subclass of GT::SQL::Display::HTML::Table which contains code used when displaying a link in the admin panel.
Links::HTML::Users This is a subclass of GT::SQL::Display::HTML::Table which contains code used when displaying a user in the admin panel.
Links::Parallel This manages running the link checker in parallel.
Links::Plugins A simple frontend to the plugin interface. The bulk of the work is in GT::Plugins.
Links::SiteHTML This contains all the display information. Each screen that you see is a subroutine in here and is used to parse the template and return the printed page.
Links::SQL This contains the GT::SQL::Creator code necessary to generate the SQL tables.
Links::Table::Category This is a subclass of GT::SQL::Table and contains code that needs to be run every time a category is added, altered or deleted.
Links::Table::Links This is a subclass of GT::SQL::Table and contains code that needs to be run every time a link is added, altered or deleted. Also contains the code for display a link in the admin.
Links::Table::Users This is a subclass of GT::SQL::Table and contains code that gets run everytime a user is added, altered or deleted.
Links::Tools This contains a variety of useful tools found in the admin templates.
Table of Contents