Puzzle/Sendmail/MultiPartItem.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 31 CC 2 SCAR 12.0
CC
2
Cov
0%
toString
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 =head1 NOME
2  
3 Puzzle::Sendmail::MultiPartItem - Modulo di invio mail all'utente
4  
5 =head1 SINTASSI
6  
7 use lib '/home/ecp/lib';
8 use ECP::Sendmail::MultiPartItem;
9  
10 $smail = new ECP::Sendmail::MultiPartItem ( db=>$db );
11  
12  
13 =head1 DESCRIZIONE
14  
15  
16 =cut
17  
18  
19 package Puzzle::Sendmail::MultiPartItem;
20  
21 our $VERSION = '0.02';
22  
23 use MIME::QuotedPrint;
24  
25 use Params::Validate qw(:types);
26 use base 'Class::Container';
27  
28 __PACKAGE__->valid_params(
29 id => { parse => 'string', type => SCALAR|UNDEF},
30 contentId => { parse => 'string', type => SCALAR, default => ''},
31 contentType => { parse => 'string', type => SCALAR, default => 'text/plain'},
32 body => { parse => 'string', type => SCALAR},
33 contentTransferEncoding => { parse => 'string', type => SCALAR, default => 'quoted-printable'},
34 contentDisposition => { parse => 'string', type => SCALAR|UNDEF},
35 );
36  
37 # all new valid_params are read&write methods
38 use HTML::Mason::MethodMaker(
39 read_write => [
40 [ id => __PACKAGE__->validation_spec->{'id'} ],
41 [ contentId => __PACKAGE__->validation_spec->{'contentId'} ],
42 [ contentType => __PACKAGE__->validation_spec->{'contentType'} ],
43 [ body => __PACKAGE__->validation_spec->{'body'} ],
44 [ contentTransferEncoding => __PACKAGE__->validation_spec->{'contentTransferEncoding'} ],
45 [ contentDisposition => __PACKAGE__->validation_spec->{'contentDisposition'} ],
46 ]
47 );
48  
49 sub toString {
50 my $self = shift;
51 my $ret;
52 my $boundary = '====' . $self->id . time() . $self->id . '====';
53 my $body = encode_qp $self->body;
54 $ret .=<<EOF;
55 Content-Type: $self->{contentType};charset="iso-8859-1"
56 Content-Transfer-Encoding: $self->{contentTransferEncoding}
57 Content-ID: <$self->{contentId}>
58 EOF
59  
60 $ret .= "Content-Disposition: $self->{contentDisposition}\n"
61 if ($self->contentDisposition);
62  
63 $ret .= "\n$body";
64 return $ret;
65 }
66
67 # ---------------------------- BEGIN POD ----------------------------------
68  
69  
70 =head1 AUTORE
71  
72 Emiliano Bruni, bruni@micso.it
73  
74 =cut
75
76 # ----------------------------- END POD -----------------------------------
77  
78 1;