CGI-Screen
view release on metacpan or search on metacpan
Customizing the Headline
You may provide a custom `headline' method to generate a HTML chunk to
start your screens.
sub headline { $_[0]->h1(title(@_)) }
You should overwrite the `application' method if you use the default
title and headline.
sub application { 'CGI::Screen Test' }
Customizing the Trailer
For a custom Trailer, define the `trailer' method.
sub trailer {
my ($query, $screen) = shift;
"End of Screen $screen";
}
Multiple Forms
If you want to have multiple forms on one screen, call the method
`new_form'.
sub multi_screen {
my $query = shift;
print
$query->p('This is the Main Screen'),
$query->textfield('foo'),
$query->goto('First'),
$query->new_form,
$query->textfield('foo'),
$query->goto('Second');
}
Non HTML screens
You can create non HTML screens by defining a *name*`_data' method
instead of a <name>`_screen' method. For `data' screens you have to
generate HTTP headers yourself.
sub gif_data {
my $query = shift;
print $query->header(
-type => 'image/gif',
-status => '200 OK',
-expires => '+120s',
);
my $font = $query->param('font');
my $w = GD::Font->$font()->width;
my $h = GD::Font->$font()->height;
my $im = GD::Image->new((length($query->param('foo'))+2)*$w,$h);
my $white = $im->colorAllocate(255,255,255);
my $red = $im->colorAllocate(255,0,0);
my $black = $im->colorAllocate(0,0,0);
$im->transparent($white);
$im->arc(8,8,5,5,0,360,$red);
$im->string(GD::Font->$font(),10,0,$query->param('foo'),$black);
print $im->gif;
}
Keeping parameter values
CGI::Screen keeps track of the CGI parameters used in the current form.
It simply looks at the first parameter in any call to a CGI method. If
the first parameter is `-name', the second parameter is marked as *used
parameter*. CGI::Screen passed all current parameter values not used in
hidden fields or in the query string of an anchor. So do not use old
style CGI calls to bypass this mechanism or you will end up with
multiple values for the parameters.
If you want to get rid of a parameter, you must explicitly call the
`delete' method of CGI.
BUGS
Support for importing from CGI.pm is incomplete.
AUTHOR
Ulrich Pfeifer <pfeifer@wait.de>
SEE ALSO
The CGI(3) manual and the demo CGI script eg/screen included in the
distribution.
ACKNOWLEDGEMENTS
I wish to thank Andreas Koenig koenig@kulturbox.de for the fruitful
discussion about the design of this module.
Copyright
The CGI::Screen module is Copyright (c) 1997,1998 Ulrich Pfeifer.
Germany. All rights reserved.
You may distribute under the terms of either the GNU General Public
License or the Artistic License, as specified in the Perl README file.
( run in 1.498 second using v1.01-cache-2.11-cpan-39bf76dae61 )