Lego::Part::Action - Lego part action object.
use Lego::Part::Action; my $obj = Lego::Part::Action->new; $obj->load_design_id($part_transfer_class, $part); $obj->load_element_id($part_transfer_class, $part);
new()
Constructor. Returns object.
load_design_id($part_transfer_class, $part)
Load design id to Lego::Part object. Returns undef.
load_element_id($part_transfer_class, $part)
Load element id to Lego::Part object. Returns undef.
load_design_id(): Bad transfer class. Must be 'Lego::Part::Transfer' class. Cannot load design ID. Error: %s load_element_id(): Bad transfer class. Must be 'Lego::Part::Transfer' class. Cannot load element ID. Error: %s
package Lego::Part::Transfer::Example; use base qw(Lego::Part::Transfer); use strict; use warnings; # Convert design to element. sub design2element { my ($self, $part) = @_; $self->_check_part($part); if ($part->color eq 'red' && $part->design_id eq '3002') { $part->element_id('300221'); } return; } package main; use strict; use warnings; use Lego::Part; use Lego::Part::Action; # Lego part. my $part = Lego::Part->new( 'color' => 'red', 'design_id' => '3002', ); # Lego part action. my $act = Lego::Part::Action->new; # Transfer class. my $trans = Lego::Part::Transfer::Example->new; # Load element id. $act->load_element_id($trans, $part); # Print color and design ID. print 'Color: '.$part->color."\n"; print 'Design ID: '.$part->design_id."\n"; print 'Element ID: '.$part->element_id."\n"; # Output: # Color: red # Design ID: 3002 # Element ID: 300221
Class::Utils, English, Error::Pure, Scalar::Util.
Install the Lego modules.
https://github.com/michal-josef-spacek/Lego-Part
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2013-2023 Michal Josef Špaček
BSD 2-Clause License
0.04
To install Lego::Part, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lego::Part
CPAN shell
perl -MCPAN -e shell install Lego::Part
For more information on module installation, please visit the detailed CPAN module installation guide.