blib/lib/Finance/HSHrates.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 41 CC 3 SCAR 16.7
CC
3
Cov
0%
getrates
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.3
1 # perl -w
2 #
3 # Copyright (C) 2000, Dj Padzensky <djpadz@padz.net>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #
19  
20 package Finance::HSHrates;
21 require 5.000;
22  
23 require Exporter;
24 use strict;
25 use vars qw($VERSION @EXPORT @ISA $QURL);
26  
27 use LWP::UserAgent;
28 use HTTP::Request::Common;
29  
30 $VERSION = '0.01';
31 $QURL = ("http://www.hsh.com/today.html");
32 @ISA = qw(Exporter);
33 @EXPORT = qw(&getrates);
34  
35 sub getrates {
36 my ($ua,@q);
37 $ua = LWP::UserAgent->new;
38 $ua->env_proxy();
39 foreach (split(/\015?\012/,$ua->request(GET $QURL)->content)) {
40 push @q,$1 if /<B>\s*([0-9.]+%?)\s*<\/B>/;
41 }
42 return wantarray() ? @q : \@q;
43 }
44  
45 1;
46  
47 __END__