So i may have this completely wrong and if so i apologise for the daft question! But...

I'm no web developer but have a really basic web site that i'm messing around with. I write a lot of perl and i want a button on the website to execute a perl script.

So far i've managed to so far get a hello_world.pl to execute. And so comes my question: The only way i could get it to work was by inserting the line: print "Content-type: text/html\n\n"; into the script

What if the perl script is not generating any html or anything? Say it's just a script which accesses a mySQL database and writes a file or runs some kind of system command. Do i still need the print "Content-type: text/html\n\n"; Are there other types of "Content-type"

Feel free to tell me to p*** off and do some more reading but my google-fu is clearly lacking and i might just need a nudge in the right direction. If you have any links, they'd be greatly appreciated!

Thanks!


In reply to Non-CGI perl scripts on a web server? by Amblikai

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.