http://qs1969.pair.com?node_id=137812

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

I'm working on creating on-the-fly Excel spreadsheets that are already converted to HTML. Well, I've already got that done. However, I didn't use CGI;, so I'm trying to get with the program. Except, I'm not that good with CGI (or HTML post-2.0, for that matter), so I'm a little confused.

How would I convert the following code snippet to use CGI? (Assume that all relevant variables have been set to the appropriate values. I'm not looking for advice save for how to remove the embedded HTML.)

print $file "<html xmlns:o=\"urn:schemas-microsoft-com:office:offi +ce\"\n"; print $file " xmlns:x=\"urn:schemas-microsoft-com:office:exce +l\"\n"; print $file " xmlns=\"http://www.w3.org/TR/REC-html40\">\n\n" +; print $file "<head>\n\n"; # In here are a few <META> and <LINK> tags I've already converted ... print $file "<style>\n"; print $file "<!--table\n"; print $file "{\n"; print $file " mso-displayed-decimal-separator:\"\.\";\n"; print $file " mso-displayed-thousand-separator:\"\,\";\n"; print $file "}\n"; print $file "\@page\n"; print $file "{\n"; print $file " margin:1.0in .75in 1.0in .75in;\n"; print $file " mso-header-margin:.5in;\n"; print $file " mso-footer-margin:.5in;\n"; print $file "}\n"; print $file "-->\n"; print $file "</style>\n"; print $file "<![if !supportTabStrip]><script language=\"JavaScript +\">\n"; print $file "<!--\n"; print $file " function fnUpdateTabs() {\n"; print $file " if (parent.window.g_iIEVer >= 4) {\n"; print $file " if (parent.document.readyState == \"compl +ete\" &amp;&amp;\n "; print $file " parent.frames['frTabs'].document.read +yState == \"complete\")\n"; print $file " parent.fnSetActiveSheet($sheet_num);\ +n"; print $file " else\n"; print $file " window.setTimeout(\"fnUpdateTabs();\" +, 150);\n" ; print $file " }\n"; print $file " }\n"; print $file "\n"; print $file " if (window.name != \"frSheet\")\n"; print $file " window.location.replace(\"../$source_doc\");\ +n"; print $file " else\n"; print $file " fnUpdateTabs();\n"; print $file "//-->\n"; print $file "</script>\n"; print $file "<![endif]>\n"; print $file "<!--[if gte mso 9]>\n"; print $file "<xml>\n"; print $file " <x:WorksheetOptions>\n"; print $file " <x:FreezePanes/>\n"; print $file " <x:FrozenNoSplit/>\n"; print $file " <x:SplitHorizontal>1</x:SplitHorizontal>\n"; print $file " <x:TopRowBottomPane>1</x:TopRowBottomPane>\n"; print $file " <x:ActivePane>2</x:ActivePane>\n"; print $file " <x:Selected/>\n" if $selected; print $file " <x:DoNotDisplayGridlines/>\n"; print $file " <x:ProtectContents>True</x:ProtectContents>\n"; print $file " <x:ProtectObjects>True</x:ProtectObjects>\n"; print $file " <x:ProtectScenarios>True</x:ProtectScenarios>\n"; print $file " </x:WorksheetOptions>\n"; print $file "</xml>\n"; print $file "<![endif]-->\n"; print $file "</head>\n\n";

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.