NAME
Class::Component::Recipe::Collection
ATTRIBUTES
classes
The actual list of classes. Provides get_classes
and set_classes
. Has to be an ArrayRef and is empty by default.
METHODS
install($target_class, $base_class)
Installs the list of classes and the $base_class
in the $target_class
.
_ensure_loaded_class($class)
Takes care that the passed class name is loaded.
push($class, [$force])
Pushes a class at the end of the list.
If the $class
is already present in the list, this is a no-op and will return 0
. This can be changed by specifying a positive value for $force
, which will remove the existing element before pushing. If the list has been changed, a 1
is returned.
pop()
Returns and removes the last element of the list.
unshift($class, [$force])
Pushes a class at the beginning of the list.
If the class is already present, this will be a no-op and just return 0
. If the $force
value is set to a positive value, any existing value will be removed before the unshifting. If the list was changed, a 1
is returned.
shift()
Returns and removes the first element from the list.
insert($class, $position, [$force])
Inserts $class
in the list at $position
.
If the class already exists in the list, this is a no-op and will just return 0
. If the <$force> value is set to a positive value any other mentioning of the class in the list will be removed first. If the list got changed a 1
is returned.
remove($class)
This removes the $class
from the list. If $class
is not even in the list, it returns 0
, otherwise 1
if it really changed something.
replace($class, $replacement)
This will replace $class
in the list with $replacement
. The call will croak
if the $class
is not even in the list.
get_position_of($class)
Returns the position of the class in the list (zero based) or undef
if it's not in there.
has_class($class)
This predicate returns true or false depending on the existance of $class
in the list.
AUTHOR
Robert 'phaylon' Sedlacek <phaylon@dunkelheit.at>
LICENSE AND COPYRIGHT
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.