Class/Info.pm

filter: Statementstmt 61.5% 24 / 39 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 63.6% 7 / 11 Podpod 100% 3 / 3 totaltotal 51.5% 34 / 66 CC 6 SCAR 20.7
CC
6
Cov
49%
new
20.0
_make_hash
12.0
dump
2.0
CRAP 7.9
« Class/File.pm ↑ Summary Class/Repos.pm »
1 package SVN::Class::Info;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use base qw( Rose::Object );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Rose::Object::MakeMethods::Generic (
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 scalar => [
7 qw( path name wc_root _url root rev
8 node schedule author last_rev date
9 updated checksum uuid rel_url
10 )
11 ]
12 3 );
13 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use Data::Dump;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use SVN::Class::Repos;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 3 our $VERSION = '0.18';
18  
19 =head1 NAME
20  
21 SVN::Class::Info - Subversion workspace info
22  
23 =head1 SYNOPSIS
24  
25 use SVN::Class;
26
27 my $file = svn_file( 'path/to/file' );
28 my $info = $file->info;
29 printf "repository URL = %s\n", $info->url;
30
31 =head1 DESCRIPTION
32  
33 SVN::Class::Info represents the output of the C<svn info> command.
34  
35 =head1 METHODS
36  
37 SVN::Class::Info B<does not> inherit from SVN::Class, but only
38 Class::Accessor::Fast.
39  
40 =cut
41  
42 =head2 new( $dir->stdout )
43  
44 Creates new SVN::Class::Info instance. The lone argument should
45 be an array ref of output from a call to the SVN::Class object's
46 info() method.
47  
48 You normally do not need to use this method directly. See the SVN::Class
49 info() method.
50  
51 =cut
52  
53 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
54 0 my $class = shift;
55 0 my $buf = shift;
56 0 ▶ if ( !$buf or !ref($buf) or ref($buf) ne 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $buf && ref $buf or ref $buf ne "ARRAY") 0 0 0
Condition0%0/6
not $buf && ref $buf or ref $buf ne "ARRAY"
l!l&&r!l&&!r
000
$buf && ref $buf
!ll&&!rl&&r
000
MC/DC0%0/3
not $buf && ref $buf or ref $buf ne "ARRAY"
$buf ref $buf ref $buf ne "ARRAY"
Truth table0%0/4
not(A && B) or C
A= $bufB= ref $bufC= ref $buf ne "ARRAY"
ABCresult
0XX1
10X1
1111
1100
57 0 croak "need array ref of 'svn info' output";
58 }
59 0 return $class->SUPER::new( _make_hash(@$buf) );
60 }
61  
62 =head2 dump
63  
64 Returns dump() of the object, just like SVN::Class->dump().
65  
66 =cut
67  
68 0 ▶sub dump {
Subroutine dump: not called CC=1 SCAR=6.9
Pod documented
69 0 return Data::Dump::dump(@_);
70 }
71  
72 3 my %fieldmap = (
73 Path => 'path',
74 Name => 'name',
75 URL => '_url',
76 'Working Copy Root Path' => 'wc_root',
77 'Relative URL' => 'rel_url',
78 'Repository Root' => 'root',
79 'Repository UUID' => 'uuid',
80 'Revision' => 'rev',
81 'Node Kind' => 'node',
82 'Schedule' => 'schedule',
83 'Last Changed Author' => 'author',
84 'Last Changed Rev' => 'last_rev',
85 'Last Changed Date' => 'date',
86 'Text Last Updated' => 'updated',
87 'Checksum' => 'checksum'
88 );
89  
90 0 ▶sub _make_hash {
Subroutine _make_hash: not called CC=3 SCAR=24.8
91 0 my %hash;
92 0 for (@_) {
93 0 my ( $field, $value ) = (m/^([^:]+):\ (.+)$/);
94 0 ▶ if ( !exists $fieldmap{$field} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $fieldmap{$field}) 0 0 0
95 0 croak "unknown field name in svn info: $field";
96 }
97 0 $hash{ $fieldmap{$field} } = $value;
98 }
99 0 return %hash;
100 }
101  
102 =head2 url
103  
104 Get the URL value. Returns a SVN::Class::Repos object.
105  
106 =cut
107  
108 0 ▶sub url {
Subroutine url: not called CC=1 SCAR=6.9
Pod documented
109 0 my $self = shift;
110 0 return SVN::Class::Repos->new( $self->_url );
111 }
112  
113 =head2 path
114  
115 =head2 wc_root
116  
117 Working Copy Root Path
118  
119 =head2 name
120  
121 =head2 root
122  
123 =head2 rev
124  
125 =head2 node
126  
127 =head2 schedule
128  
129 =head2 author
130  
131 =head2 last_rev
132  
133 =head2 date
134  
135 =head2 updated
136  
137 =head2 checksum
138  
139 =head2 uuid
140  
141 Get/set the info params. These are really only useful as accessors (getters).
142  
143 =head2 rel_url
144  
145 =cut
146  
147 3 1;
148  
149 __END__
« Class/File.pm ↑ Summary Class/Repos.pm »