line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
|
|
|
|
require 5.004; |
13
|
|
|
|
|
|
|
|
14
|
19
|
|
|
19
|
|
110
|
use Carp; |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
1718
|
|
15
|
|
|
|
|
|
|
|
16
|
19
|
|
|
19
|
|
109
|
use strict; |
|
19
|
|
|
|
|
38
|
|
|
19
|
|
|
|
|
860
|
|
17
|
19
|
|
|
19
|
|
103
|
use base qw(Exporter); |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
1991
|
|
18
|
19
|
|
|
19
|
|
136
|
use vars qw($VERSION @EXPORT @ISA $AUTOLOAD); |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
8806
|
|
19
|
|
|
|
|
|
|
$VERSION = "0.06"; |
20
|
|
|
|
|
|
|
@EXPORT = qw(); |
21
|
|
|
|
|
|
|
@ISA = qw(Mail::MboxParser::Base Mail::MboxParser::Mail); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init(@) { |
24
|
0
|
|
|
0
|
0
|
|
my ($self, $ent, @args) = @_; |
25
|
0
|
|
|
|
|
|
$self->{TOP_ENTITY} = $ent; |
26
|
0
|
|
|
|
|
|
$self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub delete_from_header(@) { |
30
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
31
|
0
|
|
|
|
|
|
$self->{TOP_ENTITY}->head->delete($_) for @_; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub add_to_header(@) { |
35
|
0
|
|
|
0
|
1
|
|
my ($self, $what) = (shift, shift); |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if (not ref $what) { |
38
|
0
|
|
|
|
|
|
croak <
|
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
|
0
|
|
|
|
|
$args{where} = 'BEHIND' if not exists $args{where}; |
46
|
0
|
0
|
|
|
|
|
if ($args{where} eq 'BEFORE') { $index = 0 } |
|
0
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ($args{where} eq 'BEHIND') { $index = -1 } |
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$self->{TOP_ENTITY}->head->add(@{$what}); |
|
0
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub replace_in_header($$) { |
53
|
0
|
0
|
|
0
|
1
|
|
if (@_ != 3) { |
54
|
0
|
|
|
|
|
|
croak <
|
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
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |