This is how you write that stuff ( both home.pl and wel.pl ), you print from Main, your ThisPage() or ThatPage() returns $headers, $body
#!/usr/bin/perlml --
##
##
##
## 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 $q = CGI->new;
return print GoToWellWithCookies( $q );
} ## end sub Main
sub UrlFor {
my( $q, $path ) = @_;
return $path;
} ## end sub UrlFor
sub ValidLogin {
my( $q ) = @_;
my $user = $q->param( 'login' );
my $pass = $q->param( 'pass' );
## YOUR JOB :)
return !!1 if $user eq $pass;
return !!0;
} ## end sub ValidLogin
## sub TryAndLoginToGoHome
## accepts $query
## returns $headers, $body;
##
sub GoToWellWithCookies {
my( $q ) = @_;
if( my $user = ValidLogin( $q ) ) {
my $cookie = $q->cookie(
-name => 'id',
-value => $user,
-expires => '+2m',
-path => '/',
);
return $cg->redirect(
-location => UrlFor( $q, "wel.pl" ),
-cookie => $cookie,
);
} else {
;
return $cg->redirect( -location => UrlFor( $q, "home.pl" ), );
}
} ## end sub GoToWellWithCookies
__END__
__END__