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, "it used to load so quickly- I don't know what happened to it. Could you take a look?" 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
) 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->param("name"
;<br>
unless ($fetchURL) <br>
{$fetchURL=""}<br>
$webPage=get($fetchURL);<br>
<br>
<br>
$p = HTML::TokeParser->new(\"<A HREF=" TARGET="_new">print $cgiobject->header;<br>
$parser->get_tag("title"
;<br>
print "Content-type: text/html\n\n";<br>
print "$parser->get_trimmed_text";<br>
<br>
<br>
<br>
<br>
This is not working...<br>
<br>
another note- if I put print "Content-type: text/html\n\n"; 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->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>
<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, "it used to load so quickly- I don't know what happened to it. Could you take a look?" 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
<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->param("name"
unless ($fetchURL) <br>
{$fetchURL=""}<br>
$webPage=get($fetchURL);<br>
<br>
<br>
$p = HTML::TokeParser->new(\"<A HREF=" TARGET="_new">print $cgiobject->header;<br>
$parser->get_tag("title"
print "Content-type: text/html\n\n";<br>
print "$parser->get_trimmed_text";<br>
<br>
<br>
<br>
<br>
This is not working...<br>
<br>
another note- if I put print "Content-type: text/html\n\n"; 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->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>