Mbox/File.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 7 / 7 totaltotal 96.0% 48 / 50 CC 3 SCAR 4.4
CC
3
Cov
97%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Mbox.pm ↑ Summary
1 package Acme::Archive::Mbox::File;
2  
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 Acme::Archive::Mbox::File - Archive::Mbox file
9  
10 =head1 VERSION
11  
12 Version 0.01
13  
14 =cut
15  
16 4 our $VERSION = '0.01';
17  
18  
19 =head1 SYNOPSIS
20  
21 No user-servicable parts inside.
22  
23 use Acme::Archive::Mbox::File;
24  
25 my $file = Acme::Archive::Mbox->new(name => 'file/name', contents => $contents, ...);
26  
27 =head1 FUNCTIONS
28  
29 =head2 new
30  
31 Create an Acme::Archive::Mbox::File object.
32  
33 =cut
34  
35 8 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
36 8 my $class = shift;
37 8 my $name = shift;
38 8 my $contents = shift;
39 8 my %attr = @_;
40  
41 8 my $self = { name => $name, contents => $contents, %attr };
42 8 ▶ return unless ($self->{name} and $self->{contents});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"name"} and $self->{"contents"} 1 7 8
Condition66%2/3
$self->{"name"} and $self->{"contents"}
!ll&&!rl&&r
017
MC/DC50%1/2
$self->{"name"} and $self->{"contents"}
$self->{"name"} $self->{"contents"}
Truth table66%2/3
A and B
A= $self->{"name"}B= $self->{"contents"}
ABresult
0X0
100
111
43 7 return bless $self, $class;
44 }
45  
46 =head2 name
47  
48 Returns the name of the file.
49  
50 =cut
51  
52 11 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod documented
53 11 my $self = shift;
54 11 return $self->{name};
55 }
56  
57 =head2 contents
58  
59 Returns the contents of the file.
60  
61 =cut
62  
63 6 ▶sub contents {
Subroutine contents: called CC=1 SCAR=0.0
Pod documented
64 6 my $self = shift;
65 6 return $self->{contents};
66 }
67  
68 =head2 mode
69  
70 Returns the mode of the file.
71  
72 =cut
73  
74 4 ▶sub mode {
Subroutine mode: called CC=1 SCAR=0.0
Pod documented
75 4 my $self = shift;
76 4 return $self->{mode};
77 }
78  
79 =head2 uid
80  
81 Returns the owner's uid.
82  
83 =cut
84  
85 5 ▶sub uid {
Subroutine uid: called CC=1 SCAR=0.0
Pod documented
86 5 my $self = shift;
87 5 return $self->{uid};
88 }
89  
90 =head2 gid
91  
92 Returns the gid of the group which owns the file.
93  
94 =cut
95  
96 4 ▶sub gid {
Subroutine gid: called CC=1 SCAR=0.0
Pod documented
97 4 my $self = shift;
98 4 return $self->{gid};
99 }
100  
101 =head2 mtime
102  
103 Returns the mtime of the file as a unix timestamp.
104  
105 =cut
106  
107 4 ▶sub mtime {
Subroutine mtime: called CC=1 SCAR=0.0
Pod documented
108 4 my $self = shift;
109 4 return $self->{mtime};
110 }
111  
112 =head1 AUTHOR
113  
114 Ian Kilgore, C<< <iank at cpan.org> >>
115  
116 =head1 BUGS
117  
118 =over 4
119  
120 =item This module is pretty much a hash. Don't expect it to be very robust.
121  
122 =back
123  
124 =head1 NOTES
125  
126 =over 4
127  
128 =item No special precaution is made against storing files with absolute
129 paths or directory traversals in their names; this is up to the
130 extraction tool.
131  
132 =back
133  
134 =head1 COPYRIGHT & LICENSE
135  
136 Copyright 2008 Ian Kilgore, all rights reserved.
137  
138 This program is free software; you can redistribute it and/or modify it
139 under the same terms as Perl itself.
140  
141 =cut
142  
143 4 1; # End of Acme::Archive::Mbox
« Mbox.pm ↑ Summary