The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lego::From::PNG::Brick - A simple representation of a lego brick

SYNOPSIS

  use Lego::From::PNG::Brick;

  my ($color, $depth, $length, $height) = ('BLACK', 1, 2, 1);

  # depth x length x height
  my $object = Lego::From::PNG::Brick->new(
      color  => $color,
      depth  => $depth,
      length => $length,
      height => $height,
      meta   => {} # Anything else we want to track
  );

  # Get at the data with accessors

DESCRIPTION

Representation of a Lego Brick plus additional meta data about that brick

USAGE

new

 Usage     : ->new()
 Purpose   : Returns Lego::From::PNG::Brick object

 Returns   : Lego::From::PNG::Brick object
 Argument  :
                color  -> must be a valid color from L<Lego::From::PNG::Const>
                depth  -> brick depth, defaults to 1
                length -> brick length, defaults to 1
                height -> brick height, defaults to 1
                meta   -> a hashref of additional meta data for the instanciated brick
 Throws    : Dies if the color is invalid

 Comment   : Clobbers meta if it's not a valid hashref
 See Also  :

id

See identifier

identifier

 Usage     : ->identifier()
 Purpose   : Returns brick id, which is based on color, depth, length and width

 Returns   : the indentifier. Format: <color>_<depth>x<length>x<height>
 Argument  :
 Throws    :

 Comment   : Identifiers aren't necessarily unique, more than one brick could have the same identifier and different meta for instance
 See Also  :

color

 Usage     : ->color() or ->color($new_color)
 Purpose   : Returns lego color for the brick, optionally a new color may be set

 Returns   : lego color value for this brick
 Argument  : Optional. Pass a scalar with a new valid color value to change the bricks color
 Throws    :

 Comment   :
 See Also  :

depth

 Usage     : ->depth() or ->depth($new_number)
 Purpose   : Returns depth for the brick, optionally a new depth may be set

 Returns   : depth value for this brick
 Argument  : Optional. Pass a scalar with a new valid depth value to change the bricks depth
 Throws    :

 Comment   :
 See Also  :

length

 Usage     : ->length() or ->length($new_number)
 Purpose   : Returns length for the brick, optionally a new length may be set

 Returns   : length value for this brick
 Argument  : Optional. Pass a scalar with a new valid length value to change the bricks length
 Throws    :

 Comment   :
 See Also  :

height

 Usage     : ->height() or ->height($new_number)
 Purpose   : Returns height for the brick, optionally a new height may be set

 Returns   : height value for this brick
 Argument  : Optional. Pass a scalar with a new valid height value to change the bricks height
 Throws    :

 Comment   :
 See Also  :

meta

 Usage     : ->meta()
 Purpose   : Returns brick meta data

 Returns   : brick meta data
 Argument  :
 Throws    :

 Comment   :
 See Also  :

color_info

 Usage     : ->color_info()
 Purpose   : Returns hash of color info related to bricks current color

 Returns   : hash of color info
 Argument  :
 Throws    :

 Comment   :
 See Also  :

flatten

 Usage     : ->flatten()
 Purpose   : Returns an unblessed version of the data

 Returns   : hashref of brick data
 Argument  :
 Throws    :

 Comment   :
 See Also  :

BUGS

SUPPORT

AUTHOR

    Travis Chase
    CPAN ID: GAUDEON
    gaudeon@cpan.org
    https://github.com/gaudeon/Lego-From-Png

COPYRIGHT

This program is free software licensed under the...

    The MIT License

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

perl(1).