Lego::From::PNG::Brick - A simple representation of a lego brick
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
Representation of a Lego Brick plus additional meta data about that brick
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 :
See 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 :
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 :
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 :
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 :
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 :
Usage : ->meta() Purpose : Returns brick meta data Returns : brick meta data Argument : Throws : Comment : See Also :
Usage : ->color_info() Purpose : Returns hash of color info related to bricks current color Returns : hash of color info Argument : Throws : Comment : See Also :
Usage : ->flatten() Purpose : Returns an unblessed version of the data Returns : hashref of brick data Argument : Throws : Comment : See Also :
Travis Chase CPAN ID: GAUDEON gaudeon@cpan.org https://github.com/gaudeon/Lego-From-Png
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.
perl(1).
To install Lego::From::PNG, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lego::From::PNG
CPAN shell
perl -MCPAN -e shell install Lego::From::PNG
For more information on module installation, please visit the detailed CPAN module installation guide.