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_noun 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 "$text\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 freenode #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 '
'.Title.'
and
.
if ($main_class) {
print Class($main_class);
}
print '>';
Heading(1,Title);
#the juicy center
print "\n";
1