File Coverage

blib/lib/Chess/ICC.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 31 32 96.8


line stmt bran cond sub pod time code
1             package Chess::ICC;
2              
3             require 5.005_62;
4 1     1   754 use strict;
  1         2  
  1         39  
5 1     1   5 use warnings;
  1         2  
  1         31  
6              
7 1     1   1143 use Data::Dumper;
  1         22275  
  1         88  
8 1     1   1388 use HTML::TreeBuilder;
  1         68829  
  1         14  
9 1     1   981 use LWP::Simple;
  1         122006  
  1         13  
10              
11             require Exporter;
12              
13             our @ISA = qw(Exporter);
14              
15             # Items to export into callers namespace by default. Note: do not export
16             # names by default without a very good reason. Use EXPORT_OK instead.
17             # Do not simply export all your public functions/methods/constants.
18              
19             # This allows declaration use Chess::ICC ':all';
20             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
21             # will save memory.
22             our %EXPORT_TAGS = ( 'all' => [ qw(
23            
24             ) ] );
25              
26             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
27              
28             our @EXPORT = qw(
29            
30             );
31             our $VERSION = '0.02';
32              
33              
34             # Preloaded methods go here.
35              
36             sub games {
37 1     1 0 94 my (undef, %cfg) = @_;
38 1         6 my $url = "http://www.chessclub.com/finger/$cfg{of}";
39 1         66 warn "querying $url";
40 1         11 my $content = get $url;
41 1         1115830 my $tree = HTML::TreeBuilder->new_from_content($content);
42             # warn $tree;
43 1         113728 warn $content;
44 1         43 my $h3 = $tree->look_down('_tag' => 'h3');
45 1         2574 my $table = $tree->look_down('_tag' => 'table');
46 1         368 my @tr = $table->look_down('_tag' => 'tr');
47 1         2169 warn "we have ", scalar @tr, " rows";
48             # warn Dumper($games);
49             }
50              
51             1;
52             __END__