Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Including .cgi into a cgi page

by slurch901 (Initiate)
on Jan 27, 2013 at 23:27 UTC ( #1015596=perlquestion: print w/ replies, xml ) Need Help??
slurch901 has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, Basically the pages I'm creating have alot of reused code and I know it's possible to add all the reused code to a separate file and import it into my .cgi page much like you can do with the php include but I'm at a dead end of searching through the web for a cgi answer, any suggestions would be greatly appreciated.

Comment on Including .cgi into a cgi page
Re: Including .cgi into a cgi page
by NetWallah (Abbot) on Jan 28, 2013 at 01:25 UTC
    Have you looked at the perl functions require , use and do ?

                 Most people believe that if it ain't broke, don't fix it.
            Engineers believe that if it ain't broke, it doesn't have enough features yet.

Re: Including .cgi into a cgi page
by Anonymous Monk on Jan 28, 2013 at 02:17 UTC

    but I'm at a dead end of searching through the web for a cgi answer, any suggestions would be greatly appreciated.

    CGI doesn't really have much to do with it

    Visit Tutorials and read Simple Module Tutorial

    Also, get a copy of Modern Perl , it covers same territory and more

Re: Including .cgi into a cgi page
by dsheroh (Parson) on Jan 28, 2013 at 10:05 UTC
    I'm not quite clear on what you're attempting to combine here.

    Are you trying to combine a bunch of Perl code into a central collection which can be accessed by multiple CGI programs? If so, look for information on creating Perl modules.

    Are you trying to build individual pages by assembling reusable pieces of HTML, such as standard/shared headers, footers, or sidebars? If so, you need a templating system. Template::Toolkit is the current 800-lb gorilla of Perl templates, but there are other good options out there, such as Alloy (which is mostly TT-compatible, but faster) and Xslate (my current preference).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2014-12-25 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (161 votes), past polls