Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Well, I think your question is a little unclear to me, but I'll try and do a spot of guesswork and shoot in a few directions... just a reminder: try to preview before you submit a question, a bit of punctuation and a few paragraph <p> tags here and there could help a lot

If I understand correctly, your scenario is that you've written a CGI script, which generates HTML (using print statements or heredocs)..

Now this posting is a great place to start reading on why you need to put your HTML in a different file.. quite simply, you want to separate your code from your presentation (HTML) because that makes it easier to maintain... if someone asks you to do minor changes to the HTML, then you need to dig through all of your code to find out the place to change, and you could actually break some of your code in the process...

Another thing, if you separate your HTML into another file, someone who doesn't know Perl well, but who does know HTML could actually figure out what to do, and fix it..

Another option that I think you mention is to generate an HTML file and display that on the webserver, rather than a CGI script.. (correct me if I didn't guess right).. well, you could do this, but then your content would no longer be dynamic, it would have to rely on your CGI script executing periodically and regenerating your HTML file.. if you need to display something that doesn't change very often, or if it does not need to be customized by individual viewers of your site (for example, a site like Perlmonks has to be customized and dynamic because different users have different views of the content on the site), then generating static HTML pages will mean that the webserver doesn't have a lot of overhead running a CGI script..

I hope this answered your question.. if you need any clarification or if I didn't answer what you needed to know, please reply on this thread...


In reply to Re: Separation of content and code by tinman
in thread Separation of content and code by Draff

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found