The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Graphics::Grid::UnitLike - Role for unit-like classes in Graphics::Grid

VERSION

version 0.001

DESCRIPTION

This role represents something that can be used as unit-value.

CLASS METHODS

is_absolute_unit($unit_name)

This is a class method. It tells if the given unit name is absolute or not.

    my $is_absolute = Graphics::Grid::UnitLike->is_absolute_unit('cm');

METHODS

elems

Number of effective values in the object.

length

This is an alias of elems().

at

slice($indices)

Slice by indices.

string()

Returns a string representing the object.

sum()

Sum the effective unit vector in a unit object.

append($other)

Append two UnitLike objects. If both are Graphics::Grid::Unit objects, this method would return a Graphics::Grid::Unit object. Otherwise, it would return a Graphics::Grid::UnitList object.

insert($other, $after=$self->elems-1)

Insert another UnitLike object after index $after. Insert before first element if after is a negative value.

transform_to_cm($grid, $idx, $gp, $length_cm)

SEE ALSO

Graphics::Grid

Graphics::Grid::Unit

Graphics::Grid::UnitArithmetic

Graphics::Grid::UnitList

AUTHOR

Stephan Loyd <sloyd@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018-2023 by Stephan Loyd.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.