
svoirin
New User
May 12, 2006, 6:35 PM
Post #1 of 3
(16423 views)
|
Finance::HSHrates Perl module
|
Can't Post
|
|
I've try using the example of this module but it just returns a blank screen so I've come up with this which is basically the module but it's still not working. Could someone take a look at this for me and give me some feedback. I just trying to pull National Mortgage rates from this site. #### Script start #### #!/usr/bin/perl -w use CGI qw(:standard); use CGI::Carp (fatalsToBrowser); $q = new CGI; print $q->header; require Exporter; use strict; use vars qw($VERSION @EXPORT @ISA $QURL @a); use LWP::UserAgent; use HTTP::Request::Common; $VERSION = '0.01'; $QURL = ("http://www.hsh.com/today.html"); @ISA = qw(Exporter); @EXPORT = qw(&getrates); @a = getrates(); print "30 Year Fixed: $a[0]<br>"; print "Points: $a[1]<br><br>"; print "15 Year Fixed: $a[2]<br>"; print "Points: $a[3]<br><br>"; print "1-Year Adjustable: $a[4]<br>"; print "Points: $a[5]<br><br>"; sub getrates { my ($ua,@q); $ua = LWP::UserAgent->new; $ua->env_proxy(); foreach (split(/\015?\012/,$ua->request(GET $QURL)->content)) { push @q,$1 if /<B>\s*([0-9.]+%?)\s*<\/B>/; } return wantarray() ? @q : \@q; } #################
|