in reply to mod_perl website structure
# file:Fyp/Main.pm ###################################### package Fyp::Main; #This file is linked to /fyp location use strict; use warnings; use Apache2::RequestRec (); use Apache2::Const -compile => qw(OK); use Fyp::Index; sub handler { my $r = shift; $r->content_type('text/html'); Fyp::Index::init(); return Apache2::Const::OK; } 1;
# file: Fyp/Index.pm #################################### # Mark O'Donovan 2011 package Fyp::Index; use strict; use warnings; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(OK); use Fyp::Html; use Fyp::Security; sub init() { #my $r = shift; #$r->content_type('text/plain'); #print "mod_perl 2.0 rocks!\n"; Fyp::Html::printHeader(); Fyp::Security::checkLogin(); Fyp::Html::printFooter(); } 1;
# file: Fyp/Html.pm ##################################### # Mark O'Donovan 2011 package Fyp::Html; use strict; use warnings; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(OK); sub printHeader() { print << "END"; <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w +3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Carina - Web Interface</title> + <link rel="stylesheet" type="text/css" href="fyp.css" /> </head> <body> <h1>Welcome to Carina</h1> END } sub printFooter() { print << "END"; </body> </html> END } 1;
Thanks very much for the info so far,# file: Fyp::Security.pm ################################ # Mark O'Donovan 2011 package Fyp::Security; use strict; use warnings; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(OK); sub checkLogin() { print "\t<p>You are not logged in</p>\n"; } 1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: mod_perl website structure
by Anonymous Monk on Oct 14, 2011 at 01:35 UTC |