blib/lib/Mail/Transport/Dbx.pm

filter: Statementstmt 62.7% 37 / 59 Branchbran 20.0% 2 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod n/a totaltotal 59.4% 47 / 79 CC 7 SCAR 19.1
CC
7
Cov
57%
folder_path
20.0
DESTROY
6.0
AUTOLOAD
3.0
CRAP 6.8
↑ Summary Dbx.xs »
1 package Mail::Transport::Dbx;
2  
3 5 ▶use 5.00503;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 require Exporter;
8 5 require DynaLoader;
9 5 ▶use AutoLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 @ISA = qw(Exporter
12 DynaLoader);
13  
14 5 %EXPORT_TAGS = ( 'all' => [ qw(
15 DBX_BADFILE
16 DBX_DATA_READ
17 DBX_EMAIL_FLAG_ISSEEN
18 DBX_FLAG_BODY
19 DBX_INDEXCOUNT
20 DBX_INDEX_OVERREAD
21 DBX_INDEX_READ
22 DBX_INDEX_UNDERREAD
23 DBX_ITEMCOUNT
24 DBX_NEWS_ITEM
25 DBX_NOERROR
26 DBX_TYPE_EMAIL
27 DBX_TYPE_FOLDER
28 DBX_TYPE_NEWS
29 DBX_TYPE_VOID
30 ) ] );
31  
32 5 @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
33  
34 5 @EXPORT = qw(
35 DBX_BADFILE
36 DBX_DATA_READ
37 DBX_EMAIL_FLAG_ISSEEN
38 DBX_FLAG_BODY
39 DBX_INDEXCOUNT
40 DBX_INDEX_OVERREAD
41 DBX_INDEX_READ
42 DBX_INDEX_UNDERREAD
43 DBX_ITEMCOUNT
44 DBX_NEWS_ITEM
45 DBX_NOERROR
46 DBX_TYPE_EMAIL
47 DBX_TYPE_FOLDER
48 DBX_TYPE_NEWS
49 DBX_TYPE_VOID
50 );
51  
52 5 $VERSION = '0.07';
53  
54 5 my %FOLDERS;
55 0 ▶sub Mail::Transport::Dbx::Folder::folder_path {
Subroutine folder_path: not called CC=4 SCAR=30.0
56 0 my $self = shift;
57 0 my $id = $self->id;
58 0 my $dbx = $self->_dbx;
59
60 0 my $folders = $FOLDERS{ $dbx };
61 # get folders data (just first time this function is called)
62 0 ▶ if (! $folders) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($folders) 0 0 0
63 0 for my $sub ($dbx->subfolders) {
64 0 my $i = $sub->id;
65 0 $folders->{$i}{'name'} = $sub->name;
66 0 $folders->{$i}{'parent_id'} = $sub->parent_id;
67 }
68 0 $FOLDERS{ $dbx } = $folders;
69 }
70 # get path
71 0 my @path;
72 0 my $i = $id;
73 0 unshift @path, $folders->{$id}{'name'};
74 0 ▶ while ($i != $folders->{$i}{'parent_id'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i != $folders->{$i}{"parent_id"}) 0 0 0
75 0 $i = $folders->{$i}{'parent_id'};
76 0 unshift @path, $folders->{$i}{'name'};
77 }
78 0 return @path;
79 }
80
81 0 ▶sub Mail::Transport::Dbx::Folder::DESTROY {
Subroutine DESTROY: not called CC=2 SCAR=17.9
82 0 my $self = shift;
83 0 my $dbx = $self->_dbx;
84 0 ▶ delete $FOLDERS{ $dbx } if defined $dbx;
Branch: 1 branch
BranchTrueFalseTotal
if defined $dbx 0 0 0
85 0 $self->_DESTROY;
86 }
87  
88 15 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=11.1
89 # This AUTOLOAD is used to 'autoload' constants from the constant()
90 # XS function.
91  
92 15 my $constname;
93 15 ($constname = $AUTOLOAD) =~ s/.*:://;
94 15 ▶ croak "&Mail::Transport::Dbx::constant not defined"
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 15 15
95 if $constname eq 'constant';
96 15 my ($error, $val) = constant($constname);
97 0 ▶ if ($error) { croak $error; }
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 0 15 15
98 {
99 5 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
100 # Fixed between 5.005_53 and 5.005_61
101 #XXX if ($] >= 5.00561) {
102 #XXX *$AUTOLOAD = sub () { $val };
103 #XXX }
104 #XXX else {
105 15 ▶ *$AUTOLOAD = sub { $val };
Subroutine __ANON__: called CC=1 SCAR=0.0
106 #XXX }
107 }
108 15 goto &$AUTOLOAD;
109 }
110  
111 5 bootstrap Mail::Transport::Dbx $VERSION;
112  
113 # Preloaded methods go here.
114  
115 # Autoload methods go after =cut, and are processed by the autosplit program.
116  
117 5 1;
118 __END__
↑ Summary Dbx.xs »