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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.