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

In reply to Re: mod_perl website structure by shiftee
in thread mod_perl website structure by shiftee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.