Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Seeing Perl in a new light

by Lady_Aleena (Chaplain)
on Apr 19, 2009 at 08:56 UTC ( #758557=note: print w/ replies, xml ) Need Help??


in reply to Seeing Perl in a new light

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


Comment on Re: Seeing Perl in a new light
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://758557]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-09-21 04:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls