MboxParser/Mail/Convertable.pm

filter: Statementstmt 45.9% 17 / 37 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 75.0% 3 / 4 totaltotal 40.6% 24 / 59 CC 7 SCAR 25.5
CC
7
Cov
36%
add_to_header
30.0
delete_from_header
6.0
replace_in_header
6.0
CRAP 12.9
« MboxParser/Mail/Body.pm ↑ Summary MboxParser/Base.pm »
1 # Mail::MboxParser - object-oriented access to UNIX-mailboxes
2 # Convertable.pm - allow altering of mail for multiple purposes
3 #
4 # Copyright (C) 2001 Tassilo v. Parseval
5 # This program is free software; you can redistribute it and/or
6 # modify it under the same terms as Perl itself.
7  
8 # Version: $Id: Convertable.pm,v 1.6 2002/02/21 09:06:15 parkerpine Exp $
9  
10 package Mail::MboxParser::Mail::Convertable;
11  
12 20 require 5.004;
13  
14 20 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 20 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 20 ▶use vars qw($VERSION @EXPORT @ISA $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 20 $VERSION = "0.06";
20 20 @EXPORT = qw();
21 20 @ISA = qw(Mail::MboxParser::Base Mail::MboxParser::Mail);
22  
23 0 ▶sub init(@) {
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
24 0 my ($self, $ent, @args) = @_;
25 0 $self->{TOP_ENTITY} = $ent;
26 0 $self;
27 }
28  
29 0 ▶sub delete_from_header(@) {
Subroutine delete_from_header: not called CC=2 SCAR=17.9
Pod documented
30 0 my $self = shift;
31 0 $self->{TOP_ENTITY}->head->delete($_) for @_;
32 }
33  
34 0 ▶sub add_to_header(@) {
Subroutine add_to_header: not called CC=5 SCAR=34.0
Pod documented
35 0 my ($self, $what) = (shift, shift);
36  
37 0 ▶ if (not ref $what) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $what) 0 0 0
38 0 croak <<EOC;
39 Error: First argument to add_to_header must be a reference to a list with
40 two elements.
41 EOC
42 }
43 0 my %args = @_;
44 0 my $index;
45 0 ▶ $args{where} = 'BEHIND' if not exists $args{where};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args{"where"} 0 0 0
46 0 ▶ if ($args{where} eq 'BEFORE') { $index = 0 }
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"where"} eq "BEFORE") 0 0 0
47 0 ▶ if ($args{where} eq 'BEHIND') { $index = -1 }
Branch: 1 branch
BranchTrueFalseTotal
if ($args{"where"} eq "BEHIND") 0 0 0
48
49 0 $self->{TOP_ENTITY}->head->add(@{$what});
50 }
51  
52 0 ▶sub replace_in_header($$) {
Subroutine replace_in_header: not called CC=2 SCAR=17.9
Pod documented
53 0 ▶ if (@_ != 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ != 3) 0 0 0
54 0 croak <<EOC;
55 Error: replace_in_headers() needs two arguments.
56 EOC
57 }
58 0 shift->{TOP_ENTITY}->head->replace(shift, shift);
59 }
60  
61  
62  
63 20 1;
64  
65 __END__
« MboxParser/Mail/Body.pm ↑ Summary MboxParser/Base.pm »