My progress to date - Start.pm
package Start;
use strict;
use warnings;
use diagnostics;
use vars qw($body_class $main_class $contents)
use Cwd;
use CGI qw();
use CGI::Carp qw(fatalsToBrowser);
use File::Basename qw(fileparse basename dirname);
use File::Spec;
use Lingua::EN::Inflect qw(PL PL_N PL_V PL_ADJ NO NUM PL_eq PL_N_eq PL
+_V_eq PL_ADJ_eq A AN PART_PRES ORD NUMWORDS inflect classical def_nou
+n def_verb def_adj def_a def_an);
print "content-type: text/html \n\n";
sub Class {
my ($class) = @_;
print " class=\"$class\"";
}
sub Heading {
my ($level, $text) = @_;
print "<h$level>$text</h$level>\n";
}
#Written with the help of SAS_Spidey01 on #perl on freenode
my $cwd = getcwd;
my $rootdir = 0;
sub get_rootdir {
my @dirs = ('/home/lady_aleena/var/www', '/ftp/pub/www/fantasy', 'C:
+/Documents and Settings/my name/My Documents/fantasy');
my @dir = grep { $_ if $cwd =~ /^$_/ } @dirs;
return pop @dir;
};
$rootdir = get_rootdir;
#This sub written with the help of wfsp on PerlMonks and rindolf on fr
+eenode #perl.
sub Title {
my $filename = basename($0);
my $dirname = getcwd;
if ($filename ne "index.pl") {
$filename =~ tr/_/ /;
$filename =~ s/.*\/+//;
$filename =~ s/\.[^.]*\z//;
$filename = ucfirst $filename;
return $filename;
}
elsif ($dirname ne $rootdir) {
$dirname =~ tr/_/ /;
$dirname =~ s/.*\/+//;
$dirname = ucfirst $dirname;
return $dirname;
}
else {
return "Lady Aleena's home";
}
}
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w
+3.org/TR/html4/strict.dtd">
<html><head><title>'.Title.'</title><meta http-equiv="Content-Type" co
+ntent="text/html; charset=windows-1252"><link rel="stylesheet" type="
+text/css" href="../main.css"></head><body';
if ($body_class) {
print Class($body_class);
}
print '><div id="bar"></div><div id="main"'; #menu will go between <di
+v id="bar"> and </div>.
if ($main_class) {
print Class($main_class);
}
print '>';
Heading(1,Title);
#the juicy center
print "</div></body></html>\n";
1
For the juicy center, I am thinking of something simple, maybe...
print <<"CONTENTS";
$contents
CONTENTS
The above did not work as expected. I am back to the drawing board for getting the juicy center code to run in that spot. I am currently looking at SelfLoader, but I am not sure that will work either.
Thoughts and suggestions gladly accepted.
Have a nice day!
Lady Aleena
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|