Calc/BoxType.pm

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 30 / 30 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Calc/Role/Mailable.pm ↑ Summary Calc/Item.pm »
1 package Box::Calc::BoxType;
2 8 $Box::Calc::BoxType::VERSION = '1.0201';
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 with 'Box::Calc::Role::Container';
7 8 with 'Box::Calc::Role::Mailable';
8 8 ▶use Ouch;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 Box::Calc::BoxType - The container class for the types (sizes) of boxes that can be used for packing.
13  
14 =head1 VERSION
15  
16 version 1.0201
17  
18 =head1 SYNOPSIS
19  
20 my $item = Box::Calc::BoxType->new(name => 'Apple', x => 3, y => 3.3, z => 4, weight => 5 );
21  
22 =head1 METHODS
23  
24 =head2 new(params)
25  
26 Constructor.
27  
28 =over
29  
30 =item params
31  
32 =over
33  
34 =item x
35  
36 The interior width of your box.
37  
38 =item y
39  
40 The interior length of your box.
41  
42 =item z
43  
44 The interior thickness of your box.
45  
46 =item name
47  
48 The name of your box.
49  
50 =item weight
51  
52 The weight of your box.
53  
54 =back
55  
56 =back
57  
58 =head2 name
59  
60 Returns the name of this box.
61  
62  
63 =head2 category
64  
65 Returns the category name associated with this box type if any.
66  
67 =cut
68  
69  
70 8 has name => (
71 is => 'ro',
72 isa => 'Str',
73 required => 1,
74 );
75  
76 8 has category => (
77 is => 'ro',
78 isa => 'Str',
79 default => '',
80 );
81  
82 =head2 describe
83  
84 Returns a hash ref with the properties of this box type.
85  
86 =cut
87  
88 sub describe {
89 14 ▶ my $self = shift;
Subroutine describe: called CC=1 SCAR=0.0
Pod documented
90 return {
91 14 name => $self->name,
92 weight => $self->weight,
93 x => $self->x,
94 y => $self->y,
95 z => $self->z,
96 category=> $self->category,
97 };
98 }
99  
100  
101 8 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
102 8 __PACKAGE__->meta->make_immutable;
« Calc/Role/Mailable.pm ↑ Summary Calc/Item.pm »