File Coverage

blib/lib/Box/Calc/BoxType.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Box::Calc::BoxType;
2             $Box::Calc::BoxType::VERSION = '1.0201';
3 8     8   806 use strict;
  8         18  
  8         252  
4 8     8   44 use warnings;
  8         16  
  8         198  
5 8     8   569 use Moose;
  8         463321  
  8         45  
6             with 'Box::Calc::Role::Container';
7             with 'Box::Calc::Role::Mailable';
8 8     8   54071 use Ouch;
  8         1699  
  8         69  
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             has name => (
71             is => 'ro',
72             isa => 'Str',
73             required => 1,
74             );
75              
76             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     14 1 19 my $self = shift;
90             return {
91 14         330 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     8   1644 no Moose;
  8         19  
  8         49  
102             __PACKAGE__->meta->make_immutable;