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

I do not know how to program in perl but i am using some system generated code that emails form data from my website. the page that is displayed after the user clicks submit is not formated like the rest of my website. Is there any way to make the confimation page that the perl script outputs formated like the rest of my website

Replies are listed 'Best First'.
Re: Formatting Perl output
by kirbyk (Friar) on Nov 09, 2005 at 18:12 UTC
    Sure! One of Perl's biggest strength is in its text processing abilities. While no language is perfect, Perl is well suited to these kinds of tasks. Continue down this path, it is wise.

    If you have any more specific questions, feel free to post. You'll get better responses if you can show us exactly what you want it to look like, and what the data you have is.

    -- Kirby, WhitePages.com

Re: Formatting Perl output
by radiantmatrix (Parson) on Nov 09, 2005 at 20:39 UTC

    You are getting vague answers because you asked a fairly vague question. There are many ways to approach your solution, but you haven't told us such things as what you've tried to do. Also, it's hard to help without seeing some code.

    Check out How (Not) To Ask A Question for tips on getting better help, faster.

    <-radiant.matrix->
    A collection of thoughts and links from the minds of geeks
    The Code that can be seen is not the true Code
    "In any sufficiently large group of people, most are idiots" - Kaa's Law
      Thank you for your help. I just needed to find the print command.
Re: Formatting Perl output
by sgifford (Prior) on Nov 09, 2005 at 18:51 UTC
    If you're lucky, the email application uses a template to display its output, in which case you can just update the template to look like the rest of your site.

    The more annoying (and more likely) scenario is that the script is just directly printing HTML to the browser. In that case, the best way is to modify it to use some kind of templating system, then create an appropriate template. That way when your site changes in the future, you have an easier job ahead of you. Easier in the short-term would be to just change what it prints to match the rest if your site.

    Another thought: There are lots of form mail scripts available; if the script you have is difficult to configure to display how you'd like, it may be easier to switch to one that's easier to configure.

    One more thought: Make sure that, whatever you're doing, your form mail script can't be used to send spam. Otherwise pammers will eventually find it and make a horrible, horrible mess.

Re: Formatting Perl output
by cbrandtbuffalo (Deacon) on Nov 09, 2005 at 19:54 UTC
    To get you started, find the script that does the mailing and look for some lines that start with 'print'. You should see a line printing a header of some sort. After that, the stuff printed from the script is basically sent verbatim to the browser. So if you do a 'view source' on the final page, you should be able to match that up with the stuff in the print statements.

    If you can match these things up, you can start to modify the script. The simplest thing to do would be to put the HTML from the rest of your site pages into the script. For example, you might want to put in print statements to print out the HTML for your site header and your footer.

    As the other posters said, maintaining print statements like this quickly becomes tiresome. If you find you need to do this often, look into some templating options so you can pull the HTML out of the script itself.

    Good luck!

Re: Formatting Perl output
by mikeock (Hermit) on Nov 09, 2005 at 19:22 UTC
    I agree with kirbyk. Further information and you should be up and going quickly!