Box/Tie/ARRAY.pm

filter: Statementstmt 41.1% 14 / 34 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 36.3% 4 / 11 Podpod n/a totaltotal 32.1% 18 / 56 CC 6 SCAR 16.3
CC
6
Cov
33%
TIEARRAY
12.0
FETCH
6.0
STORE
6.0
CRAP 5.1
« Box/Locker/POSIX.pm ↑ Summary Box/Identity.pm »
1 # Copyrights 2001-2020 by [Mark Overmeer].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 # This code is part of distribution Mail-Box. Meta-POD processed with
6 # OODoc into POD and HTML manual-pages. See README.md
7 # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8  
9 package Mail::Box::Tie::ARRAY;
10 2 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 $VERSION = '3.009';
12  
13  
14 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19  
20 sub TIEARRAY(@)
21 0 ▶{ my ($class, $folder) = @_;
Subroutine TIEARRAY: not called CC=3 SCAR=24.8
22 0 ▶ croak "No folder specified to tie to."
Branch: 1 branch
BranchTrueFalseTotal
unless ref $folder and $folder->isa("Mail::Box") 0 0 0
Condition0%0/3
ref $folder and $folder->isa("Mail::Box")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $folder and $folder->isa("Mail::Box")
ref $folder $folder->isa("Mail::Box")
Truth table0%0/3
A and B
A= ref $folderB= $folder->isa("Mail::Box")
ABresult
0X0
100
111
23 unless ref $folder && $folder->isa('Mail::Box');
24  
25 0 bless { MBT_folder => $folder }, $class;
26 }
27  
28 #-------------------------------------------
29  
30  
31 sub FETCH($)
32 0 ▶{ my ($self, $index) = @_;
Subroutine FETCH: not called CC=2 SCAR=17.9
33 0 my $msg = $self->{MBT_folder}->message($index);
34 0 ▶ $msg->isDeleted ? undef : $msg;
Branch: 1 branch
BranchTrueFalseTotal
$msg->isDeleted ? : 0 0 0
35 }
36  
37 #-------------------------------------------
38  
39  
40 sub STORE($$)
41 0 ▶{ my ($self, $index, $msg) = @_;
Subroutine STORE: not called CC=2 SCAR=17.9
42 0 my $folder = $self->{MBT_folder};
43  
44 0 ▶ croak "Cannot simply replace messages in a folder: use delete old, then push new."
Branch: 1 branch
BranchTrueFalseTotal
unless $index == $folder->messages 0 0 0
45 unless $index == $folder->messages;
46  
47 0 $folder->addMessages($msg);
48 0 $msg;
49 }
50  
51  
52 0 ▶sub FETCHSIZE() { scalar shift->{MBT_folder}->messages }
Subroutine FETCHSIZE: not called CC=1 SCAR=6.9
53  
54  
55 sub PUSH(@)
56 0 ▶{ my $folder = shift->{MBT_folder};
Subroutine PUSH: not called CC=1 SCAR=6.9
57 0 $folder->addMessages(@_);
58 0 scalar $folder->messages;
59 }
60
61  
62 0 ▶sub DELETE($) { shift->{MBT_folder}->message(shift)->delete }
Subroutine DELETE: not called CC=1 SCAR=6.9
63  
64  
65 sub STORESIZE($)
66 0 ▶{ my $folder = shift->{MBT_folder};
Subroutine STORESIZE: not called CC=2 SCAR=17.9
67 0 my $length = shift;
68 0 $folder->message($_) foreach $length..$folder->messages;
69 0 $length;
70 }
71  
72 # DESTROY is implemented in Mail::Box
73  
74 #-------------------------------------------
75  
76  
77 2 1;
« Box/Locker/POSIX.pm ↑ Summary Box/Identity.pm »