Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

500 Server errors: fun...

Status
Not open for further replies.

carpeliam

Programmer
Mar 17, 2000
990
US
I've been given a job nobody would ever want. I'm sure you all know that you can take an Microsoft Excel document and get it to spit out a webpage. Anybody who hates WYSIWYG editors knows just how many nasty table tags they spit out. My boss at a webdesign firm decided to make a catalog using Excel, and then export to HTML.<br>
<br>
Now I have an HTML document weighing in at 1.5 MB.<br>
<br>
That's crazy. He handed it to me and said, &quot;it used to load so quickly- I don't know what happened to it. Could you take a look?&quot; Hehehe... one look at the code and I knew what happened to it. TD tags up the yin yang and all sorts of code the W3C has never seen. So now I have to get rid of them all... At first, I tried cutting and pasting the necessary stuff. Basically, I started over from scratch. Well, the catalog is huge- if I trim all the fat I can, it's going to be 300K. That's a lot of typing to do by hand.<br>
<br>
So I thought I'd try writing a Perl CGI program that would extract things out of the table and put them into a new, nicer, cleaner table (with 4 columns instead of 40). Now the old server I used to program on ran Perl 4, but now that I'm on a new server, I'm trying to take advantage of Perl 5 using some of the new parsing code. I went to a tutorial website, copied things word for word, but it won't work. Help :eek:) can you guys tell me what's wrong here? Thanks... here's my code.<br>
<br>
<br>
#!/usr/local/bin/perl<br>
use CGI;<br>
use LWP::Simple;<br>
use HTML::TokeParser;<br>
<br>
$cgiobject = new CGI;<br>
<br>
#retrieve web page<br>
$fetchURL=$cgiobject-&gt;param(&quot;name&quot;);<br>
unless ($fetchURL) <br>
{$fetchURL=&quot;&quot;}<br>
$webPage=get($fetchURL);<br>
<br>
<br>
$p = HTML::TokeParser-&gt;new(\&quot;<A HREF=" TARGET="_new">print $cgiobject-&gt;header;<br>
$parser-&gt;get_tag(&quot;title&quot;);<br>
print &quot;Content-type: text/html\n\n&quot;;<br>
print &quot;$parser-&gt;get_trimmed_text&quot;;<br>
<br>
<br>
<br>
<br>
This is not working...<br>
<br>
another note- if I put print &quot;Content-type: text/html\n\n&quot;; towards the beginning of my program, everything after it tends to be ignored for some reason- I'm not sure why. The tutorial I've been working with often has something like that towards the top (usually, they have print $cgiobject-&gt;header;, with the same result).<br>
<p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href= imotic ::</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top