SQLite::Work::CGI - Report and update a SQLite database using CGI
version 0.1601
use SQLite::Work::CGI; my $obj = SQLite::Work::CGI->new(%args);
This module is an expansion of SQLite::Work suitable for use in a CGI script to report and update a SQLite database.
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:
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.
The maximum number of sort fields required (default: 10)
Name of the sort parameter.
Prefix of the sort-reversed parameters.
Name of the headers parameter.
Name of the columns-to-show parameter.
Prefix of the 'where' parameters.
Prefix of the not-where parameters.
$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.
Update a single column in a single row, or all columns in a single row.
$obj->do_add_form($table);
Set up for adding a row to the database.
Add a row to a table.
Delete a single row.
Create the search form for the given table.
my $form = $obj->make_search_form($table, %args);
Display the search form for the given table.
Make the table selection form.
Display the table selection form.
Lower-level methods, generally just called from other methods, but possibly suitable for other things.
Print an (error) message to the user.
$self->print_message($message); # error message
$self->print_message($message, 0); # non-error message
Construct a search-a-table form
Construct an add-a-row form.
Make the buttons for the forms.
Make a button for a particular page
Print a selection result. (slightly different for Edits than for Search)
Format the report results If 'command' is 'Search' then use the parent format_report; otherwise make an edit-table.
Make a table for editing a search result.
Make a textarea for editing a search result.
Get the required input field for the table+column
SQLite::Work CGI Test::More
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}
perl(1).
Please report any bugs or feature requests to the author.
Kathryn Andersen (RUBYKAT) perlkat AT katspace dot com http://www.katspace.com
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.
To install SQLite::Work, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQLite::Work
CPAN shell
perl -MCPAN -e shell install SQLite::Work
For more information on module installation, please visit the detailed CPAN module installation guide.