#!/usr/bin/perl -- #~ ## #~ ## #~ ## #~ ## #~ ## perltidy -olq -csc -csci=3 -cscl="sub : BEGIN END " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #~ ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #~ ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use CGI (); use CGI::Carp qw( fatalsToBrowser ); Main( @ARGV ); exit( 0 ); sub Main { my( $configref ) = require './mymodule-lib.pl'; my $q = CGI->new; if( $q->request_method eq 'POST' ) { return print SaveFormRedirect( $configref->{info}, $q ); } else { return print ShowStuff( $configref, $q ); } } ## end sub Main sub SaveFormRedirect { my( $conf, $q ) = @_; write_file( $conf->{'info'}, $q ); return $q->redirect( UrlFor( $q, 'index.cgi' ) ); } ## end sub SaveFormRedirect sub UrlFor { my( $q, $modepath ) = @_; my $url = $q->url( -absolute => 1, -path => 1, ); return $url . '?' . $modepath; } ## end sub UrlFor sub ShowStuff { my( $conf, $q ) = @_; return join '', ui_print_header( undef, "Configuration Information", "", undef, 1, 1, 0 ); ui_form_start( UrlFor( $q, "index.cgi" ), "post" ), ui_table_start( "Configurations", undef, 2, ["width=30%"] ), ui_table_row( "Bandwidth", ui_textbox( "bandwidth", scalar $q->param( 'bandwidth' ), 80, 0, 40, ) ), ui_table_row( "Distance", ui_textbox( "distance", scalar $q->param( 'distance' ), 80, 0, 40, ) ), ui_table_row( "Size", ui_textbox( "size", scalar $q->param( 'size' ), 80, 0, 40, ) ), ui_table_row( "Active", ui_yesno_radio( "active", scalar $q->param( 'active' ) ? 1 : 0, 1 ) ), ui_table_end(), ui_form_end( [ [ undef, "submit" ] ] ), ui_print_footer( "/", scalar $q->param( 'index' ) ), ; } ## end sub ShowStuff __END__