Looking for help!
NAME
SQLite::Work::CGI - Report and update a SQLite database using CGI
VERSION
version 0.1601
SYNOPSIS
use SQLite::Work::CGI;
my $obj = SQLite::Work::CGI->new(%args);
DESCRIPTION
This module is an expansion of SQLite::Work suitable for use in a CGI script to report and update a SQLite database.
CLASS METHODS
new
my $obj = SQLite::Work->new( database=>$database_file, row_ids=>{ episodes=>'title_id', }, join_cols=>{ 'episodes+recordings'=>'title_id', } }, report_template=>$report_template, default_format=>{ 'episodes' => { 'title'=>'title', 'series_title'=>'title', } }, input_format=>{ 'reviews' => { 'Review'=>{ type=>'textarea', cols=>60, rows=>4, } } }, max_sort_fields=>10, sort_label=>'Zsort', sort_reversed_prefix=>'Zsort_reversed_', headers_label=>'Zheader_', show_label=>'Zshow', where_prefix=>'Zwhere_', not_prefix=>'Znot_', );
Make a new report object.
Takes the same arguments as SQLite::Work::new() plus the following additions:
- input_format
-
This contains information about what style of input field should be used for this particular column in this table. This is used for the Edit and Add forms.
- max_sort_fields
-
The maximum number of sort fields required (default: 10)
- sort_label
-
Name of the sort parameter.
- sort_reversed_prefix
-
Prefix of the sort-reversed parameters.
- headers_label
-
Name of the headers parameter.
- show_label
-
Name of the columns-to-show parameter.
- where_prefix
-
Prefix of the 'where' parameters.
- not_prefix
-
Prefix of the not-where parameters.
OBJECT METHODS
do_select
$obj->do_select($table, command=>'Search');
Select data from a table in the database. Uses CGI to get most of the parameters.
The 'command' is 'Search' by default; if it is something else, then the result generated has edit fields and buttons in it.
do_single_update
Update a single column in a single row, or all columns in a single row.
do_add_form
$obj->do_add_form($table);
Set up for adding a row to the database.
do_add
Add a row to a table.
do_single_delete
Delete a single row.
make_search_form
Create the search form for the given table.
my $form = $obj->make_search_form($table, %args);
do_search_form
Display the search form for the given table.
make_table_form
Make the table selection form.
do_table_form
Display the table selection form.
Helper Methods
Lower-level methods, generally just called from other methods, but possibly suitable for other things.
print_message
Print an (error) message to the user.
$self->print_message($message); # error message
$self->print_message($message, 0); # non-error message
search_form
Construct a search-a-table form
make_add_form
Construct an add-a-row form.
make_buttons
Make the buttons for the forms.
make_page_button
Make a button for a particular page
print_select
Print a selection result. (slightly different for Edits than for Search)
format_report
Format the report results If 'command' is 'Search' then use the parent format_report; otherwise make an edit-table.
make_edit_table
Make a table for editing a search result.
make_edittext
Make a textarea for editing a search result.
get_input_field
Get the required input field for the table+column
REQUIRES
SQLite::Work
CGI
Test::More
INSTALLATION
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
In order to install somewhere other than the default, such as in a directory under your home directory, like "/home/fred/perl" go
perl Build.PL --install_base /home/fred/perl
as the first step instead.
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, and the PATH variable to find the script.
Therefore you will need to change: your path, to include /home/fred/perl/script (where the script will be)
PATH=/home/fred/perl/script:${PATH}
the PERL5LIB variable to add /home/fred/perl/lib
PERL5LIB=/home/fred/perl/lib:${PERL5LIB}
SEE ALSO
perl(1).
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.