Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

perl webpage

by Anonymous Monk
on Sep 13, 2001 at 00:03 UTC ( [id://112004]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,
I have a webpage that I maintain on a reqular bases and I have decided to convert it to perl entirely. Now before you start thinking about mod_perl.... let me tell you that my web host doesn't have it installed and I don't think they will any time soon. Moving to another web host isn't an immediate option either. I was looking at one module (CGI.pm) I believe is the name and it outputs some ugly html when I viewed the source.... is there a way to make better formatted?

My website is uses frames and embedded perl scripts already but I want to go pure perl....

To reiterate: What is the best way to turn a website from HTML to pure perl....

-David

Replies are listed 'Best First'.
Re: perl webpage
by Zaxo (Archbishop) on Sep 13, 2001 at 00:15 UTC

    use CGI::Pretty;The "ugly" html from vanilla CGI.pm is significantly smaller. You might want to revert once your prettyprinted stuff has been approved.

    After Compline,
    Zaxo

      what about my mod_perl problem there's no other alternative?
Re: perl webpage
by andreychek (Parson) on Sep 13, 2001 at 00:35 UTC
    Very few people will be looking at your HTML anyway :-) But Zaxo is correct, CGI's HTML tends to be efficient.

    However, don't forget that you can always install mod_perl on your own. Go download the Apache and mod_perl source, compile them, and you can run it on a non-standard port. Depending on the amount of traffic you forsee, your web provider might appreciate it :-)

    One of the bigger problems with this method though is that if your web provider reboots their machine, your version of Apache won't be started. But you can always create a cron job to verify that things are working right, and have it start your Apache if not.

    Good luck!
    -Eric
Re: perl webpage
by arturo (Vicar) on Sep 13, 2001 at 10:37 UTC

    If you're taking an existing set of pure HTML pages and adding dynamic portions to them, you'll want to look into using a templating system. Whether you want to just add dynamic parts, or to go whole hog like perlmonks (every page on this site is built out of dynamically generated chunks). The first approach, you build up a web page out of a single large template, filling in the dynamic parts. With the second, you'd build each piece (using small templates for the pieces, perhaps) and put them all together.

    A *really* nice aspect of this approach is that it gives you a better separation between designing the look and writing the program to stuff the information into the containers (this is called "separating content and program logic"). Neither of these will entirely obviate CGI.pm, mind you.

    Perl modules that come to mind (and there is a Tutorial on this site for the first one) : HTML::Template and the Template Toolkit. There are others, but take a look at these and see if either fits your needs.

    perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://112004]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-03-28 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found