#!/usr/bin/perl -w
# program group3PreFormattedText.pl
use strict;
use lib "/pathToYourWebspace/cgi-bin/gnu";
use CGI;
use CGI::Carp qw( fatalsToBrowser);
use subjectGroup3::SideIndex;
use Comments;
use MostRecentSideIndex;
use PageFormatterTemplate;
use PathInfo;
# techie stuff: clean up environment for taint mode before calling mail
BEGIN {
$ENV{PATH} = "/bin:/usr/bin";
delete @ENV{ qw( IFS CDPATH ENV BASH_ENV) };
} # end BEGIN
# end techie stuff
# we'll be checking the environment for post parameters etc
my $cgiObj = new CGI();
# do this bit of printing to allow for early error messages
print "Content-type: text/html; charset=iso-8859-1\n\n";
# To use this template
# 1. modify the header content
# 2. modify the contentAry
# 3. modify $sideIndexObj
# pathInfo determines the side index to use
# Note that tests for informationType of any given type need only be conducted if
# the page features on one of the informationType indexes or has a payPal button
# Note that $infoString is used to carry info (if any) specific to a given type e.g.
# in the case of PayPal where I may be selling different pictures on the same page then
# $infoString will contain a picture identifier
# Note: we do not use PayPal on this page
my $pathInfoObj = PathInfo->new($cgiObj);
if ($pathInfoObj->pathInfo()) {
if ( ($pathInfoObj->printablePage() ) ||
($pathInfoObj->mostRecentSideIndex() ) ||
($pathInfoObj->workInProgressSideIndex() ) ) {
# OK
} else {
# someone is fooling around
# send message but keep going - ignore it
Mailer::sendErrorEmail("unrecognised pathInfo string","subjectGroup3","group3PreFormattedText");
} # end if
} # end if
# determine the side index to use
my $sideIndexObj = subjectGroup3::SideIndex->new();
if ($pathInfoObj->mostRecentSideIndex()) {
$sideIndexObj = MostRecentSideIndex->new();
} # end if
if ($pathInfoObj->workInProgressSideIndex()) {
$sideIndexObj = WorkInProgressSideIndex->new();
} # end if
# header content
my $metaKeywords = "I,hope,you,get,use,from,this,website,generation,program,by,julius,guzy,available,under,gnu,free,software,licence";
my $metaDescription = "I hope you get use from this website generation program by julius guzy available under,gnu free software licence";
my $pageTitle = "Example of how to encode a heading and some paragraphs of plain text";
my $indexGroup = "subjectGroup3";
my $pageFileName = "group3PreFormattedText.pl";
# the order of the elements determines the order in which the elements are written in the html
my @contentAry = (
{
contentType => "heading",
headingType => "h2",
headingText => "Example of how to encode a heading and pre-formatted text",
}, # end anon hash
{
contentType => "paragraphSequence",
paraSequence => [
"Take a look at <a href='http://yourWebsiteDotCom/gnuCodeInHtml/group3PreFormattedText.html'>the source code</a>: used to generate this page",
],
}, # end anon hash
{
contentType => "preFormatedText",
preTitle => "Figure: Extract from the Seafarer translated from Anglo-Saxon by Ezra Pound",
preText => [
"May I for my own self song's truth reckon,
Journey's jargon, how I in harsh days
Hardship endured oft.
Bitter breast-cares have I abided,
Known on my keel many a care's hold,
And dire sea-surge, and there I oft spent
Narrow nightwatch nigh the ship's head
While she tossed close to cliffs. Coldly afflicted,
My feet were by frost benumbed.
Chill its chains are; chafing sighs
Hew my heart round and hunger begot
Mere-weary mood. Lest man know not
That he on dry land loveliest liveth,
List how I, care-wretched, on ice-cold sea,
Weathered the winter, wretched outcast
Deprived of my kinsmen;
Hung with hard ice-flakes, where hail-scur flew,
There I heard naught save the harsh sea
And ice-cold wave, at whiles the swan cries,
Did for my games the gannet's clamour,
Sea-fowls, loudness was for me laughter,
The mews' singing all my mead-drink.
Storms, on the stone-cliffs beaten, fell on the stern
In icy feathers; full oft the eagle screamed
With spray on his pinion.",
],
}, # end anon hash
); # end contentAry
# check for comments data having been sent to us
# new will get these and validate them
my $commentsObj = Comments->new($cgiObj);
# pass the PageFormatter all the information used to create the page other than the content itself
my $pageObj = PageFormatterTemplate->new($cgiObj,$indexGroup,$sideIndexObj,$commentsObj,$pageFileName,$pageTitle,$metaKeywords,$metaDescription);
# we are never returning from a PayPal sale so no need to generate a special thank you page
# create the standard page
$pageObj->standardContent(\@contentAry);