NAME

Box::Calc::Box - The container in which we pack items.

VERSION

version 1.0206

SYNOPSIS

 my $box = Box::Calc::Box->new(name => 'Big Box', x => 12, y => 12, z => 18, weight => 20);

METHODS

new(params)

Constructor.

NOTE: All boxes automatically have one empty Box::Calc::Layer added to them.

params
name

An identifying name for your box.

x

The interior width of your box.

y

The interior length of your box.

z

The interior thickness of your box.

weight

The weight of your box.

fill_weight()

Returns the weight of the items in this box.

fill_x()

Returns how full the box is in the x dimension.

fill_y()

Returns how full the box is in the y dimension.

fill_z()

Returns how full the box is in the z dimension.

id()

Returns a generated unique id for this box.

name()

Returns the name of the box.

layers()

Returns an array reference of the Box::Calc::Layers in this box.

void_weight()

Returns the weight assigned to the void space left in the box due to void space filler such as packing peanuts. Defaults to 70% of the box weight.

calculate_weight()

Calculates and returns the weight of all the layers in this box, including the weight of this box and any packing filler (see void_weight).

create_layer()

Adds a new Box::Calc::Layer to this box.

pack_item(item)

Add a Box::Calc::Item to this box.

Returns 1 on success or 0 on failure.

item

The Box::Calc::Item instance you want to add to this box.

packing_list()

Returns a scalar with the weight of the box and a hash reference of all the items in this box.

packing_instructions()

Returns a description of the box. Example:

 {
  x =>  5,
  y =>  6,
  z =>  3,
  fill_x => 4,
  fill_y => '5.1',
  fill_z => 2,
  name => 'The Big Box',
  layers => [ ... ],
  id => 'xxx',
  weight => '6',
  calculated_weight => '12.35',
 }

used_volume

Returns the real used volume for this box.

fill_volume

Returns the exact volume needed for this box.