Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: mod_perl website structure

by shiftee (Initiate)
on Oct 13, 2011 at 18:36 UTC ( [id://931356]=note: print w/replies, xml ) Need Help??


in reply to mod_perl website structure

Okay, i've put together the framework of what I imagine a small perl website to be, basically I would like to know if I have done anything horrendously wrong yet
# 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;
# 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;
Thanks very much for the info so far,
Mark

Replies are listed 'Best First'.
Re^2: mod_perl website structure
by Anonymous Monk on Oct 14, 2011 at 01:35 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://931356]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-24 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found