#! /usr/bin/perl
use strict;
use warnings;
use CGI qw(param);
use LWP::Simple;
use HTML::TableExtract;
print "Content-type: text/html\n\n";
print "
Avi's Dell Warranty Status getter
Stick a service tag in the box, hit the button, see what warranty you have.
";
if(defined(param('tag'))){
my $service_tag = param('tag');
my $url_base = "http://support.euro.dell.com/support/topics/topic.aspx/emea/shared/support/my_systems_info/en/details";
my $url_params = "?c=uk&cs=ukbsdt1&l=en&s=gen";
my $url = $url_base.$url_params."&servicetag=".$service_tag;
my $content = get($url);
# Tell HTML::TableExtract to pick out the table(s) whose class is 'contract_table':
my $table = HTML::TableExtract->new( attribs => { class => "contract_table" } );
$table->parse($content);
## Gimme infos!
foreach my $ts ($table->tables) {
print "| ";
foreach my $row ($ts->rows) {
print "", join(" | ", @$row), "\n";
print " |
| ";
}
# print " |
| ";
}
}
print " |
";
print "sauce home non-cgi";;
print "";