Workflow::Base(3)
π Workflow::Base(3) π
User Contributed Perl Documentation β¨ Workflow::Base(3)
okay bestie, welcome to Workflow::Base β the little base class that could, the mom friend of your object hierarchy. it's giving "foundation", it's giving "constructor with benefits" π«Ά
πΈ NAME πΈ
Workflow::Base β a base class with a constructor. that's it. that's the name. short, sweet, iconic.
π VERSION π
this doc is describing version 2.09 of this package. yes, 2.09. write it down.
π¦ SYNOPSIS π¦
package My::App::Foo;
use parent qw( Workflow::Base );
that's literally it, babe. inherit and you're in the club π
β¨ DESCRIPTION β¨
it provides a constructor plus a lil handful of other genuinely useful methods for subclasses. no cap, that's the whole job. it's the base β the rest of the family builds on top of it.
π METHODS π
π Class Methods
new( @params )β just makes you a brand new object (a blessed hashref, classic) and hands all of@paramsstraight over to theinit()method. andinit()is a thing subclasses can override so they can set themselves up however they want. Returns: the new object. periodt.
π§ Object Methods
init( @params )β subclasses may implement this to do their initialization. the@paramsare whatever got passed intonew(). nothing needs to be returned β no pressure, it's not that kind of method πlog()β returns the logger for the instance, based on the instance class. iykyk.param( [ $name, $value ] )β associate arbitrary parameters with this object. this one has several moods, so let's go one by one:- if you give it neither
$namenor$value, it returns a hashref of all the parameters set in the object:
- if you give it neither
my $params = $object->param();
while ( my ( $name, $value ) = each %{ $params } ) {
print "$name = $params->{ $name }\n";
}
- if
$nameis given and it's a hash reference, it assigns all the values of that reference to the object parameters. this is the way to assign multiple parameters at once. heads up though β these will overwrite any existing parameter values. it returns a hashref of all parameters set in the object.
$object->param({ foo => 'bar',
baz => 'blarney' });
- if
$nameis given and it is not a hash reference, it returns the value associated with it, andundefif$namewas never set before.
my $value = $object->param( 'foo' );
print "Value of 'foo' is '$value'\n";
- if both
$nameand$valueare given, it associates$namewith$value, overwriting any existing value, and returns the new value.
$object->param( foo => 'blurney' );
delete_param( [ $name ] )β deletes parameters from this object. also multi-mood:- if
$nameis given and it's an array reference, then it deletes all those parameters from the object. all the deleted parameters come back as a hash reference together with their values.
- if
my $deleted = $object->delete_param(['foo','baz']);
foreach my $key (keys %{$deleted})
{
print $key."::=".$deleted->{$key}."\n";
}
- if
$nameis given and it is not an array reference, it deletes the parameter and returns the value of the parameter.
my $value = $object->delete_param( 'foo' );
print "Value of 'foo' was '$value'\n";
- if
$nameis not defined, or$namedoes not exist, thenundefis returned. so like. don't @ it.
clear_params()β clears out all parameters associated with this object. scorched earth, bestie π₯normalize_array( \@array | $item )β if given\@arrayit returns it dereferenced; if given$item, it returns it in a list. if given neither, it returns an empty list. lowkey the most flexible method in the whole file.
π COPYRIGHT π
Copyright (c) 2003-2021 Chris Winters. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Please see the LICENSE.
π AUTHORS π
Please see Workflow.
ok so that's the whole page, no skips, no cuts π go forth and bless some hashrefs.
perl v5.42.0 Β· 2026-01-17 Β· Workflow::Base(3) β mwah, that's a wrap, bestie πβ¨π¦
π¦ where this page comes from
- fedora 44: perl-Workflow 2.09-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms