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 SCAR 23.8
CC
6
Cov
49%
new
20.0
_make_hash
12.0
dump
2.0
CRAP 10.8
« Class/Dir.pm ↑ Summary Class/File.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 use Rose::Object::MakeMethods::Generic (
6 3 scalar => [
7 qw( path name wc_root _url root rev
8 node schedule author last_rev date
9 updated checksum uuid
10 )
11 ]
12 3 ▶);
Subroutine BEGIN: called CC=1 SCAR=0.0
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.17';
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 sub new {
54 0 ▶ my $class = shift;
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
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 sub dump {
69 0 ▶ return Data::Dump::dump(@_);
Subroutine dump: not called CC=1 SCAR=6.9
Pod documented
70 }
71  
72 3 my %fieldmap = (
73 Path => 'path',
74 Name => 'name',
75 URL => '_url',
76 'Working Copy Root Path' => 'wc_root',
77 'Repository Root' => 'root',
78 'Repository UUID' => 'uuid',
79 'Revision' => 'rev',
80 'Node Kind' => 'node',
81 'Schedule' => 'schedule',
82 'Last Changed Author' => 'author',
83 'Last Changed Rev' => 'last_rev',
84 'Last Changed Date' => 'date',
85 'Text Last Updated' => 'updated',
86 'Checksum' => 'checksum'
87 );
88  
89 sub _make_hash {
90 0 ▶ my %hash;
Subroutine _make_hash: not called CC=3 SCAR=24.8
91 0 for (@_) {
92 0 my ( $field, $value ) = (m/^([^:]+):\ (.+)$/);
93 0 ▶ if ( !exists $fieldmap{$field} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $fieldmap{$field}) 0 0 0
94 0 croak "unknown field name in svn info: $field";
95 }
96 0 $hash{ $fieldmap{$field} } = $value;
97 }
98 0 return %hash;
99 }
100  
101 =head2 url
102  
103 Get the URL value. Returns a SVN::Class::Repos object.
104  
105 =cut
106  
107 sub url {
108 0 ▶ my $self = shift;
Subroutine url: not called CC=1 SCAR=6.9
Pod documented
109 0 return SVN::Class::Repos->new( $self->_url );
110 }
111  
112 =head2 path
113  
114 =head2 wc_root
115  
116 Working Copy Root Path
117  
118 =head2 name
119  
120 =head2 root
121  
122 =head2 rev
123  
124 =head2 node
125  
126 =head2 schedule
127  
128 =head2 author
129  
130 =head2 last_rev
131  
132 =head2 date
133  
134 =head2 updated
135  
136 =head2 checksum
137  
138 =head2 uuid
139  
140 Get/set the info params. These are really only useful as accessors (getters).
141  
142 =cut
143  
144 3 1;
145  
146 __END__
« Class/Dir.pm ↑ Summary Class/File.pm »