NAME

Posy::Plugin::InfoSQLite - Posy plugin which gives supplementary entry information.

VERSION

This describes version 0.01 of Posy::Plugin::InfoSQLite.

SYNOPSIS

    @plugins = qw(Posy::Core
	Posy::Plugin::YamlConfig
	...
	Posy::Plugin::Info
	Posy::Plugin::InfoSQLite
	...);

DESCRIPTION

This plugin overrides the Posy::Plugin::Info plugin, giving the ".info" information in an SQLite database rather than in .info files. This will set $info_* flavour variables which can be used in flavour templates.

This plugin replaces the 'info' method for returning the info related to an entry. The other Posy::Plugin::Info functionality remains unchanged.

Note that if you were using the 'index_info' action for Posy::Plugin::Info, it is best to remove it when using Posy::Plugin::InfoSQLite, since it is now a redundant waste of time and space.

Note that it is entirely up to the user to populate and design the SQLite database which is going to be used. This plugin simply enables the contents of one table (or view) of that database to be used in Posy flavour templates.

This plugin expects (a) a database (b) a table (c) a column within that table which has a value for each entry you want Info information on. There are two ways which this can be done. One is for the column to contain a straight entry-id. The other is for it to contain a URL relative to the top of the site -- that is, basically like the entry-id, but with a known extension like .html. The second method is useful if you want to use the database to be accessed separately and still have useable URL data (for example, if you use a separate search CGI script designed for SQLite databases).

Configuration

This expects configuration settings in the $self->{config} hash, which, in the default Posy setup, can be defined in the main "config" file in the data directory.

infosqlite_db

The location of the SQLite database file.

infosqlite_table

The name of the table (or view) from which to get the info data.

infosqlite_entry_id_col

The name of the column in the table which contains the file-id of the entry file (see also infosqlite_url_col).

infosqlite_url_col

An alternative to infosqlite_entry_id_col; this contains the name of the column in the table which has the URL of the entry file; basically, the same as the file-id, but with a proper extension.

OBJECT METHODS

Documentation for developers and those wishing to write plugins.

init

Do some initialization; make sure that default config values are set.

Flow Action Methods

Methods implementing actions. All such methods expect a reference to a flow-state hash, and generally will update either that hash or the object itself, or both in the course of their running.

init_settings

Initialize at start.

tidy_up

Tidy up at the end.

Helper Methods

Methods which can be called from within other methods.

info

my %vars = $self->info($entry_id);

Gets the .info fields related to the given entry.

my $val = $self->info($entry_id, field=>$name);

Get the value of the given .info field for this entry.

read_info_from_db

my %info = $self->read_info_from_db($entry_id);

Get the Info from the database.

infosqlite_convert_value

    my $val = $obj->infosqlite_convert_value(value=>$val,
	format=>$format,
	name=>$name);

Convert a value according to the given formatting directive.

Directives are:

upper

Convert to upper case.

lower

Convert to lower case.

int

Convert to integer

float

Convert to float.

string

Return the value with no change.

truncatenum

Truncate to num length.

dollars

Return as a dollar value (float of precision 2)

percent

Show as if the value is a percentage.

title

Put any trailing ,The or ,A at the front (as this is a title)

comma_front

Put anything after the last comma at the front (as with an author name)

month

Convert the number value to a month name.

nth

Convert the number value to a N-th value.

url

Convert to a HTML href link.

email

Convert to a HTML mailto link.

hmail

Convert to a "humanized" version of the email, with the @ and '.' replaced with "at" and "dot"

html

Convert to simple HTML (simple formatting)

proper

Convert to a Proper Noun.

wordsnum

Give the first num words of the value.

alpha

Convert to a string containing only alphanumeric characters (useful for anchors or filenames)

namedalpha

Similar to 'alpha', but prepends the 'name' of the value. Assumes that the name is only alphanumeric.

Private Methods

Methods which may or may not be here in future.

infosqlite_simple_html

$val = $obj->infosqlite_simple_html($val);

Do a simple HTML conversion of the value. bold, italic, <br>

INSTALLATION

Installation needs will vary depending on the particular setup a person has.

Administrator, Automatic

If you are the administrator of the system, then the dead simple method of installing the modules is to use the CPAN or CPANPLUS system.

cpanp -i Posy::Plugin::InfoSQLite

This will install this plugin in the usual places where modules get installed when one is using CPAN(PLUS).

Administrator, By Hand

If you are the administrator of the system, but don't wish to use the CPAN(PLUS) method, then this is for you. Take the *.tar.gz file and untar it in a suitable directory.

To install this module, run the following commands:

perl Build.PL
./Build
./Build test
./Build install

Or, if you're on a platform (like DOS or Windows) that doesn't like the "./" notation, you can do this:

perl Build.PL
perl Build
perl Build test
perl Build install

User With Shell Access

If you are a user on a system, and don't have root/administrator access, you need to install Posy somewhere other than the default place (since you don't have access to it). However, if you have shell access to the system, then you can install it in your home directory.

Say your home directory is "/home/fred", and you want to install the modules into a subdirectory called "perl".

Download the *.tar.gz file and untar it in a suitable directory.

perl Build.PL --install_base /home/fred/perl
./Build
./Build test
./Build install

This will install the files underneath /home/fred/perl.

You will then need to make sure that you alter the PERL5LIB variable to find the modules.

Therefore you will need to change the PERL5LIB variable to add /home/fred/perl/lib

PERL5LIB=/home/fred/perl/lib:${PERL5LIB}

REQUIRES

Posy
Posy::Core
Posy::Plugin::Info

Test::More

SEE ALSO

perl(1). Posy Posy::Plugin::Info SQLite::Work

BUGS

Please report any bugs or feature requests to the author.

AUTHOR

Kathryn Andersen (RUBYKAT)
perlkat AT katspace dot com
http://www.katspace.com

COPYRIGHT AND LICENCE

Copyright (c) 2005 by Kathryn Andersen

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.