Mail/Make/Body.pm

filter: Statementstmt 72.9% 27 / 37 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 58.8% 10 / 17 Podpod 77.7% 7 / 9 totaltotal 66.6% 44 / 66 CC 2 SCAR 6.4
CC
2
Cov
69%
length
6.0
as_string
2.0
data
2.0
CRAP 1.9
« Mail/Make/Body/InCore.pm ↑ Summary MM/Const.pm »
1 ##----------------------------------------------------------------------------
2 ## MIME Email Builder - ~/lib/Mail/Make/Body.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2026 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2026/03/02
7 ## Modified 2026/03/02
8 ## All rights reserved.
9 ##
10 ## This program is free software; you can redistribute it and/or modify it
11 ## under the same terms as Perl itself.
12 ##----------------------------------------------------------------------------
13 package Mail::Make::Body;
14 BEGIN
15 9 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
16 9 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 9 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 9 warnings::register_categories( 'Mail::Make' );
19 9 ▶ use parent qw( Module::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 9 ▶ use vars qw( $VERSION $EXCEPTION_CLASS );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 9 ▶ use Mail::Make::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 9 our $EXCEPTION_CLASS = 'Mail::Make::Exception';
23 9 our $VERSION = 'v0.1.0';
24 };
25  
26 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 # Returns the body content as a scalar ref.
30 # Must be overridden by subclasses.
31 sub as_string
32 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
33 0 my $self = shift( @_ );
34 0 return( $self->error( ref( $self ) . "::as_string() is not implemented." ) );
35 }
36  
37 0 ▶sub data { return( shift->as_string( @_ ) ); }
Subroutine data: not called CC=1 SCAR=6.9
Pod documented
38  
39 # Returns the byte length of the body content.
40 sub length
41 0 ▶{
Subroutine length: not called CC=2 SCAR=17.9
Pod documented
42 0 my $self = shift( @_ );
43 0 ▶ my $string = $self->as_string || return( $self->pass_error );
Condition0%0/2
$self->as_string || (return $self->pass_error)
l!l
00
MC/DC0%0/1
$self->as_string || (return $self->pass_error)
$self->as_string
Truth table0%0/2
A
A= $self->as_string
Aresult
11
00
44 0 return( CORE::length( $$string ) );
45 }
46  
47 # Returns true if the body is stored on disk (Body::File), false otherwise.
48 39 ▶sub is_on_file { return(0); }
Subroutine is_on_file: called CC=1 SCAR=0.0
Pod documented
49  
50 # Returns true if the body is stored in memory (Body::InCore), false otherwise.
51 1 ▶sub is_in_core { return(0); }
Subroutine is_in_core: called CC=1 SCAR=0.0
Pod documented
52  
53 # path() is only meaningful for Body::File; returns undef here.
54 0 ▶sub path { return; }
Subroutine path: not called CC=1 SCAR=6.9
Pod documented
55  
56 # Empties / releases the body content. Subclasses override.
57 0 ▶sub purge { return( shift ); }
Subroutine purge: not called CC=1 SCAR=6.9
Pod documented
58  
59 # NOTE: STORABLE support
60 0 ▶sub STORABLE_freeze { CORE::return( CORE::shift->FREEZE( @_ ) ); }
Subroutine STORABLE_freeze: not called CC=1 SCAR=6.9
Pod undocumented
61  
62 0 ▶sub STORABLE_thaw { CORE::return( CORE::shift->THAW( @_ ) ); }
Subroutine STORABLE_thaw: not called CC=1 SCAR=6.9
Pod undocumented
63  
64 9 1;
65 # NOTE: POD
66 __END__
« Mail/Make/Body/InCore.pm ↑ Summary MM/Const.pm »