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

PickLE::Component - Representation of an electronic component in a pick list

ATTRIBUTES

picked

Has the component in the list already been picked?

name

Name or part number of the component. A way to uniquely identify this component in the list without being too descriptive.

value

Component value if it has one. Useful for things like passive components. This attribute also has associated clearer (clear_value) and predicate (has_value) methods.

description

A brief description of the component to make it easier to understand what the often times cryptic name refers to. This attribute also has associated clearer (clear_description) and predicate (has_description) methods.

case

Since package is kind of a reserved word, this defines the component package as a simple string. This attribute also has associated clearer (clear_case) and predicate (has_case) methods.

refdes

A list reference of reference designators for this component. This is important since it'll be the only way this class can determine the quantity of components to be picked.

METHODS

$comp = PickLE::Component->new([picked, name, value, description, case, refdes])

Initializes a component object with a name, the reference designator list (refdes), if the component has been picked, a value in cases where it is applicable, a brief description if you see fit, and an component package (case).

$comp = PickLE::Component->from_line($line)
$comp = $comp->from_line($line)

This method can be called statically, in which it will initialize a brand new component object, or in object context in which it'll override just the attributes of the object and leave the instance intact.

In both variants it'll parse a component descriptor $line and populate the component object. Will return undef if we couldn't parse a component from the given line.

$comp->parse_refdes_line($line)

Parses the reference designator line in a document and populates the refdes list with them.

$comp->add_refdes(@refdes)

Adds any number of reference designators to the reference designator list.

$quantity = $comp->quantity()

Gets the quantity of the component to be picked.

$str = $comp->refdes_string()

Gets the list of reference designators seoarated by spaces as a string.

$str = $comp->as_string()

Gets the string representation of this object.

PRIVATE METHODS

$available = $self->_attr_available($attribute)

Checks if an $attribute is defined and isn't an empty string.

AUTHOR

Nathan Campos <nathan@innoveworkshop.com>

COPYRIGHT

Copyright (c) 2022- Nathan Campos.