Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    export to html file

    Hi
    how to export perl script results to HTML files?
    inserting the results of a perl script into an html document then convert it to pdf file

  • #2
    New Coder
    Join Date
    Aug 2005
    Posts
    71
    Thanks
    9
    Thanked 3 Times in 3 Posts
    mero,

    just a quick bit of advice. when looking for answers to problems, it is best to include any code you may already have so that others can evaluate what you are trying to do and respond with content pertinent code. with that, i'll try and get you pointed in the right direction.

    what you are asking has numerous examples if you search google. this will end up being one more of those

    assuming your output from your cgi script is data in the form of vars, then creating an HTML page would look something like this.
    Code:
    #vars are $firstName and $lastName
    
    #this is the expanded version for clarity
    print "Content-type:text/html\r\n\r\n";
    print "<html>";
    print "<head>";
    print "<title>Hello Visitor</title>";
    print "</head>";
    print "<body>";
    print "<h2>Hello $firstName $lastName</h2>";
    print "</body>";
    print "</html>";
    
    #using HERE DOCUMENTS to shrink the code
    print <<"END_HTML";
    Content-type:text/html\r\n\r\n
    <html>
    <head>
    <title>Hello Visitor</title>
    </head>
    <body>
    <h2>Hello $firstName $lastName</h2>
    </body>
    </html>
    END_HTML
    notice you do not have to keep typing the print, quotes or semicolon when using heredocs. you need to make sure you put the closing END_HTML statement on a new line with no spaces before or after it or perl with give you errors.

    as far as the pdf portion goes, you will probably need to find an add on for your server to be able to do the conversion and use that programs' usage docs for scripting examples.
    It's OK to pee against the wind if your standing in a lake.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •