File Coverage

blib/lib/Box/Calc/Item.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Box::Calc::Item;
2             $Box::Calc::Item::VERSION = '1.0201';
3 13     13   199359 use strict;
  13         53  
  13         400  
4 13     13   66 use warnings;
  13         22  
  13         359  
5 13     13   1770 use Moose;
  13         1520647  
  13         89  
6              
7             with 'Box::Calc::Role::Dimensional';
8              
9              
10             =head1 NAME
11              
12             Box::Calc::Item - The container class for the items you wish to pack.
13              
14             =head1 VERSION
15              
16             version 1.0201
17              
18             =head1 SYNOPSIS
19              
20             my $item = Box::Calc::Item->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 width of your item.
37              
38             =item y
39              
40             The length of your item.
41              
42             =item z
43              
44             The thickness of your item.
45              
46             =item weight
47              
48             The weight of your item.
49              
50             =item name
51              
52             The name of your item. If you're referring it back to an external system you may wish to use this field to store you item ids instead of item names.
53              
54             =back
55              
56             =back
57              
58              
59             =head2 name
60              
61             Returns the name of this item.
62              
63             =cut
64              
65             has name => (
66             is => 'ro',
67             isa => 'Str',
68             required => 1,
69             );
70              
71             =head2 describe
72              
73             Returns all the important details about this item as a hash reference.
74              
75             =cut
76              
77             sub describe {
78 10460     10460 1 14085 my $self = shift;
79             return {
80 10460         229745 name => $self->name,
81             weight => $self->weight,
82             x => $self->x,
83             y => $self->y,
84             z => $self->z,
85             };
86             }
87              
88             =head1 ROLES
89              
90             This class installs L<Box::Calc::Role::Dimensional>.
91              
92             =cut
93              
94 13     13   85277 no Moose;
  13         33  
  13         68  
95             __PACKAGE__->meta->make_immutable;