Mike Martin wrote:

: I am trying not to go this route because I want to keep the
: subsidiary files as self-contained as possible
: 
: There are four files at present which are around 600 lines,
: which I think is a sensible size. These all do a specific job
: which can be linked together.
: 
: It would be nice to be able to distribute together or separate

    I see. You could use a system call to the dispatch the scripts
from the first form. User and password could be sent on the
command line.


#!/usr/bin/perl -T

use strict;
use warnings;

use CGI::Carp 'fatalsToBrowser';
use CGI qw( header param :html :form );

if ( param('tasks') ) {
    dispatch();

} else {
    print task_form();
}

sub dispatch {

    my %tasks = (
        calendar    => '',
        contacts    => '/cgi-bin/contacts.pl',
        correspond  => '',
        filing      => '',
        file_manage => '/cgi-bin/finance.pl',
        finance     => '',
        telephone   => '',
        timesheets  => '/cgi-bin/timesheet.pl',
    );

    # Dispatch to script. *Not Tested*
    foreach my $task ( param('tasks') ) {
        next unless $tasks{$task};
        system(
            $tasks{$task},
            param('user'),
            param('pass'),
        );
    }
}

sub task_form {

    my %tasks = (
        calendar    => 'Calendars',
        contacts    => 'Contacts',
        correspond  => 'Correspondence',
        filing      => 'Filing',
        file_manage => 'File Management',
        finance     => 'Finance',
        telephone   => 'Telephone Logging',
        timesheets  => 'Timesheets',
    );

    return
        header(),
        start_html( -style => '/proj.css' ),
            start_multipart_form(),

                'user', br(),
                textfield(
                    -name => 'user',
                    -size => 15,
                ), br(),
                'password', br(),
                password_field( -name => 'pass' ), br(), br(),

                'Choose a task', br(),
                scrolling_list(
                    -name     => 'tasks',
                    -values   => [ sort keys %tasks ],
                    -labels   => \%tasks,
                    -multiple => 'true',
                ),

                span(
                    { -class => 'place_cmd' },
                    submit(
                        -name  => 'act',
                        -value => 'Chooser',
                    )
                ),
                br(),
            end_form(),
        end_html();
}

__END__


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

Don't tread on my bandwidth. Trim your posts.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to