Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: export to html file
10-12-2011, 01:27 PM #1
- Join Date
- Jul 2011
- Thanked 0 Times in 0 Posts
export to html file
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
11-09-2011, 05:24 PM #2
- Join Date
- Aug 2005
- Thanked 3 Times in 3 Posts
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.
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.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
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.