File Coverage

blib/lib/Egg/View/Mail/Plugin/Jfold.pm
Criterion Covered Total %
statement 9 17 52.9
branch 0 2 0.0
condition 0 2 0.0
subroutine 3 4 75.0
pod n/a
total 12 25 48.0


line stmt bran cond sub pod time code
1             package Egg::View::Mail::Plugin::Jfold;
2             #
3             # Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
4             #
5             # $Id: Jfold.pm 285 2008-02-28 04:20:55Z lushe $
6             #
7 2     2   833 use strict;
  2         5  
  2         73  
8 2     2   12 use warnings;
  2         5  
  2         138  
9 2     2   11 use Jcode;
  2         5  
  2         489  
10              
11             our $VERSION = '0.01';
12              
13             sub __get_mailbody {
14 0     0     my($self, $data)= @_;
15 0           my $body= $self->next::method($data);
16 0           my $j = $self->{jcode_context}= Jcode->new('jcode');
17 0   0       my $len = $data->{line_length} || 72;
18 0           my $text;
19 0           for (split /\n/, $$body) {
20 0 0         $text.= $_ ? join("\n", $j->set(\$_)->jfold($len)). "\n" : "\n";
21             }
22 0           \$text;
23             }
24              
25             1;
26              
27             __END__
28              
29             =head1 NAME
30              
31             Egg::View::Mail::Plugin::Jfold - The numbers of characters of each line of mail are united.
32              
33             =head1 SYNOPSIS
34              
35             package MyApp::View::Mail::MyComp;
36             use base qw/ Egg::View::Mail::Base /;
37            
38             ...........
39             .....
40            
41             __PACKAGE__->setup_plugin('Jfold');
42              
43             =head1 DESCRIPTION
44              
45             The number of characters of each line of mail is adjusted by using 'Jfold' of
46             Jcode.
47              
48             When 'Jfold' is passed to 'setup_plugin' method, it is built in.
49              
50             Please note that there is a thing that the processing result doesn't become it
51             according to the expectation when using it with other components that use
52             '__get_mailbody' in built-in the order.
53              
54             __PACKAGE__->setup_plugin(qw/
55             EmbAgent
56             Jfold
57             /);
58              
59             It comes to be able to set the following items.
60              
61             =head3 line_length
62              
63             Lengths of number of characters of each line. The number of characters of 1byte
64             character conversion is set.
65              
66             Default is '72'.
67              
68             =head1 SEE ALSO
69              
70             L<Egg::Release>,
71             L<Egg::View::Mail>,
72             L<Egg::View::Mail::Base>,
73             L<Jcode>,
74              
75             =head1 AUTHOR
76              
77             Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
78              
79             =head1 COPYRIGHT AND LICENSE
80              
81             Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>, All Rights Reserved.
82              
83             This library is free software; you can redistribute it and/or modify
84             it under the same terms as Perl itself, either Perl version 5.8.6 or,
85             at your option, any later version of Perl 5 you may have available.
86              
87             =cut
88