WWW/Scraper/Grub.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 48 CC 1 SCAR 6.9
CC
1
Cov
0%
init
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use strict;
2 package WWW::Scraper::Grub;
3  
4 #####################################################################
5  
6 use base qw(WWW::Scraper Exporter);
7 # This is an appropriate VERSION calculation to use for CVS revision numbering.
8 use vars qw($VERSION);
9 $VERSION = sprintf("%d.%02d", q$Revision: 1.0 $ =~ /(\d+).(\d+)/);
10  
11 use WWW::Scraper(qw(3.00 generic_option trimLFs trimTags removeScriptsInHTML));
12  
13 use strict;
14  
15 my $scraperRequest =
16 {
17 # This engine's method is QUERY
18 'type' => 'QUERY'
19
20 # This is the basic URL on which to get the form to build the query.
21 ,'url' => 'file://C:/TEMP/l-grub/index.html'
22  
23 # specify defaults, by native field names
24 ,'nativeQuery' => undef
25 ,'nativeDefaults' => undef
26
27 # specify translations from canonical fields to native fields
28 ,'defaultRequestClass' => undef
29 ,'fieldTranslations' =>
30 {
31 '*' =>
32 {
33 '*' => '*'
34 }
35 }
36 # Miscellaneous options for the Scraper operation.
37 ,'cookies' => 0
38 };
39  
40 my $scraperFrame =
41 [ 'HTML',
42 [
43 [ 'HIT*',
44 [
45 [ 'REGEX', '(l-grub.[^>]*?\.html)', 'url' ],
46 ]
47 ],
48 [ 'BOGUS', 2 ]
49 ]
50 ];
51  
52 my $scraperDetail =
53 [ 'HTML',
54 [
55 [ 'REGEX', '<a border="0" onMouseOver="iOver\\(\'topnext\'\\)[^>]*?href="([^"]+)"', 'nextUrl' ],
56 [ 'TABLE', '#5',
57 [
58 [ 'RESIDUE', 'section' ]
59 ]
60 ],
61 [ 'GRUB', 'nextUrl' ]
62 ]
63 ];
64  
65  
66 sub init {
67 my ($self, $subclass, $native_query, $native_options) = @_;
68 $self->SetScraperRequest($scraperRequest);
69 $self->SetScraperFrame($scraperFrame);
70 $self->SetScraperDetail($scraperDetail);
71 return $self->SUPER::init($subclass, $native_query, $native_options);
72 }
73  
74 1;
75  
76 __END__