VCS/Cvs/Dir.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 44 CC 5 SCAR 21.6
CC
5
Cov
0%
new
12.0
content
12.0
BEGIN
2.0
CRAP 8.7
1 package VCS::Cvs::Dir;
2  
3 use Carp;
4 use VCS::Cvs;
5  
6 @ISA = qw(VCS::Cvs VCS::Dir);
7  
8 use strict;
9  
10 sub new {
11 my($class, $url) = @_;
12 my $self = $class->init($url);
13 my $path = $self->path;
14 die "$class->new: $path: $!\n" unless -d $path;
15 die "$class->new: $path not a CVS directory: $!\n"
16 unless -d $path . 'CVS';
17 $self;
18 }
19  
20 sub content {
21 my $self = shift;
22 my @return;
23 local *CONTENTS;
24 open(CONTENTS, $self->path . 'CVS/Entries');
25 while (defined(my $entry = <CONTENTS>)) {
26 my ($type, $path) = $entry =~ m|^([^/]*)/([^/]*)/|;
27 next unless $path;
28 my $new_class = ($type eq 'D') ? 'VCS::Cvs::Dir' : 'VCS::Cvs::File';
29 push @return, $new_class->new($self->url . $path);
30 }
31 close CONTENTS;
32 return sort { $a->path cmp $b->path } @return;
33 }
34  
35 1;