Finance::Shares::CGI
====================

This package provides a CGI interface to the Finance::Shares
toolkit.  It comprises a number of scripts and a support
module.  Note that installation requires some manual steps
as well as the normal make commands.


INSTALLATION
============

STEP 1: Edit the CGI.pm file to tailor it to your system

    sub new {
	my $class = shift;
	my $o = {
	    ## === edit these START ===
	    user      => 'test',	# mysql user
	    password  => 'test',	# mysql password
	    database  => 'test',	# mysql database
	    base_cgi  => 'http://hawk.home.net/cgi-bin/shares',
	    base_url  => 'http://hawk.home.net/shares',
	    base_dir  => '/srv/www/htdocs/shares',
	    webmaster => 'webmaster@willmot.org.uk',
	    ## === edit these END ===
	    
The user, password and database are best left as they are
for the first trial as they match the settings used in the
Finance::Shares::Overview instructions.

base_cgi
    Root part of the URL used to access the cgi scripts from
    a browser.  I've been using cgi-bin because cgi-perl is
    a pain to develop with, but it works ok with either.

base_url
    Root part of the URL used to access the normal html
    documents.

base_dir
    This should be the path to the directory holding the
    normal html documents. index.html will be written here.

webmaster
    I would be grateful if you would change this if it goes
    onto a live site!


STEP 2:  The usual incantation may now be made

    perl Makefile.PL
    make
    make test
    make install


STEP 3:  Copy the files

Now you have decided where the files will go, copy
all the *.pl into your cgi directory and all the files in
html/ to your html directory.  

From the package directory give the command 'make_index'
which should write the index.html file to your html
directory.


STEP 4: Initialize the database

The rest of the installation is carried out from your brower
and email program.  Enter the following url into your
brower:

    http://hawk.home.net/cgi-bin/shares/init.pl?initialize=1

Choose 'list' if you're curious, or everything else
(sessions, users, tables, layouts, prompts, all) to
initialize the database.  There is no need to enter any
table names when 'all' is checked.


STEP 5: Register as a user

[Sorry: the user registration is a leftover from a test
site.  The session concept is quite deeply embedded and
I haven't got around to removing it.]

a)  Type in the site url, e.g.

	http://hawk.home.net/shares/index.html

b)  From 'Login', choose 'register here', fill in the form
    and wait for the email to arrive.

c)  Follow the emailed link to choose a password.

Now the site is available for normal use.


NOTES
=====
    
If it goes wrong you might have to delete the database and
re-create it before trying again.  At one point the
initialization only worked on an empty database, although
now adding ';initialize=1' should override that.

To recreate the database 'test'...
    mysql> drop database test;
    mysql> create database test;
Then from your brower, try again
    http://hawk.home.net/cgi-bin/shares/init.pl?initialize=1

When registration has sent an email, the user and session
tables can be checked by
    mysql> select * from t2;
    mysql> select * from t3;

An admin account is obtained by manually adding ';admin=4'
onto the end of the link emailed during registration.

The scripts can be run from the command line by giving the
command 'make_cmdline' first.  It is probably simplest to
use the web interface to set up the options, remembering the
name of the top level 'Draw chart' or 'Run model' settings.

You will probably want to copy the 'strip_cgi' script to
your cgi directory before issuing manual commands like:

    run.pl 's=cmdline' 'name=model1' | strip_cgi > outfile.ps

See Finance::Shares::CGI for further details.


