David Coppit
Tue, 26 Sep 2000 11:14:44 -0700
Here are a few tricks I use to debug handlers that have "gone wrong". Also be sure to read the handler writer's tutorial at http://www.newsclipper.com/writinghandlers.htm, and see some tips I posted at http://www.mail-archive.com/newsclipperdevlist@newsclipper.com/msg00239.html 1) First, check the output html page for a warning or error emitted by News Clipper that explains what happened. A lot of times you can determine which handler messed up this way. For example, an error like "Handler foo was loaded and executed, but the acquisition failed" would tell you that the handler couldn't grab the information from the remote site. This is probably the #1 cause of handler failures. 2) Use Perl's Data::Dumper module to see exactly what data is being processed. For example, to see what was grabbed from the remote site, do this: my $data = GetLinks($url,$startpattern,$endpattern); # Added next two lines. The "die" will cause NC to print the data and # stop use Data::Dumper; die Dumper $data; return undef unless defined $data; In this example, if you find that $data is undefined, this means that your start and end patterns are probably wrong. If the information looks okay, move your dump lines further down in the code and see what it looks like. For example, if you have some processing to remove images, you might want to dump the data right after that code to make sure it is working right. Hope that helps, David ____________________________________________________________________________ David Coppit <[EMAIL PROTECTED]> President, Spinnaker Software http://www.newsclipper.com/ -- Snip and ship dynamic content to your website - If you would like to unsubscribe from this mailing list send an email to [EMAIL PROTECTED] with the body "unsubscribe newsclipperdevlist YOUR_EMAIL_ADDRESS" (without the quotes) or use the form provided at http://www.NewsClipper.com/TechSup.htm#MailingList.