File Coverage

blib/lib/Data/Timeline/SVK.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             package Data::Timeline::SVK;
2              
3 1     1   6 use strict;
  1         1  
  1         36  
4 1     1   5 use warnings;
  1         2  
  1         30  
5 1     1   1526 use DateTime::Format::DateParse;
  1         254105  
  1         16  
6              
7              
8             our $VERSION = '0.02';
9              
10              
11 1     1   59 use base qw(Data::Timeline::Builder);
  1         3  
  1         854  
12              
13              
14             __PACKAGE__->mk_scalar_accessors(qw(base_dir));
15              
16              
17             sub create {
18             my $self = shift;
19              
20             my $timeline = $self->make_timeline;
21              
22             chdir $self->base_dir or
23             die sprintf "can't chdir to %s: $!\n", $self->base_dir;
24              
25             open my $fh, '-|', "svk log" or die "can't read from pipe 'svk log': $!\n";
26             while (<$fh>) {
27             next unless /^(r\d+:\s*\w+)\s*\|\s*(20.*)/;
28             $timeline->entries_push($self->make_entry(
29             description => $1,
30             timestamp => DateTime::Format::DateParse->parse_datetime($2),
31             type => 'svk',
32             ));
33             }
34             close $fh or die "can't close pipe to 'svk log': $!\n";
35             $timeline;
36             }
37              
38              
39             1;
40              
41              
42             __END__