-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathParsingRunner.pm
More file actions
37 lines (28 loc) · 870 Bytes
/
ParsingRunner.pm
File metadata and controls
37 lines (28 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package ParsingRunner;
# The main runner class. In general, to run a full downloading and
# parsing session, create an instance of this class and call run.
use strict;
sub new {
# To create a ParsingRunner, we need the following things, in order:
# A FileDownloader
# A FileParser
my $class = shift;
my $self = {};
my $downloader = shift;
$self->{DOWNLOADER} = $downloader;
my $parser = shift;
$self->{PARSER} = $parser;
bless($self, $class);
return $self;
}
sub run {
# run takes an input filename (or filenames - all parameters are passed
# to downloader::download), downloads
# it with downloader, and then parses it with parser.
my $self = shift;
$self->{DOWNLOADER}->download(@_);
foreach my $path ($self->{DOWNLOADER}->outputPaths()) {
$self->{PARSER}->parse($path);
}
}
1;