blib/lib/File/Find/Rule/CVS.pm

filter: Statementstmt 100% 43 / 43 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 0.0% 0 / 3 totaltotal 95.5% 64 / 67 CC 5 SCAR 4.6
CC
5
Cov
100%
_cvs_entry
3.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.6
↑ Summary
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package File::Find::Rule::CVS;
3 1 ▶use File::Find::Rule;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Parse::CVSEntries;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base 'File::Find::Rule';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 $VERSION = '0.01';
9  
10 =head1 NAME
11  
12 File::Find::Rule::CVS - find files based on CVS metadata
13  
14 =head1 SYNOPSIS
15  
16 use File::Find::Rule::CVS;
17 my @modified = find( cvs_modified => in => 'sandbox' );
18  
19 =head1 DESCRIPTION
20  
21 File::Find::Rule::CVS extends File::Find::Rule to add clauses based on
22 the contents of CVS/Entries files.
23  
24 =head1 RULES
25  
26 =cut
27  
28 15 ▶sub File::Find::Rule::_cvs_entry {
Subroutine _cvs_entry: called CC=3 SCAR=11.0
29 15 my $self = shift;
30 15 my ($file, $path) = @_;
31  
32 return $self->{_entries}{ $path }{ $file }
33 15 ▶ if exists $self->{_entries}{ $path };
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"_entries"}{$path} 8 7 15
34  
35 7 ▶ my $parse = Parse::CVSEntries->new( "CVS/Entries" )
Branch: 1 branch
BranchTrueFalseTotal
my $parse = "Parse::CVSEntries"->new("CVS/Entries") or return 4 3 7
36 or return;
37  
38 4 $self->{_entries}{ $path } = { map { $_->name => $_ } $parse->entries };
39 4 return $self->{_entries}{ $path }{ $file };
40 }
41  
42 =head2 cvs_modified
43  
44 Matches a file which the cvs sandbox thinks is modified
45  
46 =cut
47  
48 1 ▶sub File::Find::Rule::cvs_modified () {
Subroutine cvs_modified: called CC=1 SCAR=0.0
Pod undocumented
49 1 my $self = shift()->_force_object;
50 4 ▶ my $sub = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
51 4 ▶ my $entry = $self->_cvs_entry( @_ ) or return;
Branch: 1 branch
BranchTrueFalseTotal
my $entry = $self->_cvs_entry(@_) or return 2 2 4
52 2 return (stat $_)[9] > $entry->mtime;
53 1 };
54 1 $self->exec( $sub );
55 }
56  
57  
58 =head2 cvs_unknown
59  
60 Matches an entry in a working directory that CVS doesn't know about
61  
62 =cut
63  
64 1 ▶sub File::Find::Rule::cvs_unknown () {
Subroutine cvs_unknown: called CC=1 SCAR=0.0
Pod undocumented
65 1 my $self = shift()->_force_object;
66 3 ▶ my $sub = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
67 3 return !$self->_cvs_entry( @_ );
68 1 };
69 1 $self->exec( $sub );
70 }
71  
72  
73 =head2 cvs_version( $test )
74  
75 Matches files with versions that match $test. $test is a
76 Number::Compare expression applied to a L<version> object.
77  
78 =cut
79  
80 2 ▶sub File::Find::Rule::cvs_version {
Subroutine cvs_version: called CC=1 SCAR=0.0
Pod undocumented
81 2 my $self = shift()->_force_object;
82 2 my $test = Number::Compare->new( shift );
83  
84 8 ▶ my $sub = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
85 8 ▶ my $entry = $self->_cvs_entry( @_ )
Branch: 1 branch
BranchTrueFalseTotal
my $entry = $self->_cvs_entry(@_) or return 4 4 8
86 or return;
87 4 my $version = version->new( $entry->version );
88 4 return $test->( $version );
89 2 };
90 2 $self->exec( $sub );
91 }
92  
93  
94 1 1;
95 __END__
↑ Summary