1Workflow::Base(3) User Contributed Perl Documentation Workflow::Base(3)
2
3
4
6 Workflow::Base - Base class with constructor
7
9 This documentation describes version 1.61 of this package
10
12 package My::App::Foo;
13 use base qw( Workflow::Base );
14
16 Provide a constructor and some other useful methods for subclasses.
17
19 Class Methods
20 new( @params )
21
22 Just create a new object (blessed hashref) and pass along @params to
23 the init() method, which subclasses can override to initialize
24 themselves.
25
26 Returns: new object
27
28 Object Methods
29 init( @params )
30
31 Subclasses may implement to do initialization. The @params are whatever
32 is passed into new(). Nothing need be returned.
33
34 log()
35
36 Returns the logger for the instance, based on the instance class.
37
38 param( [ $name, $value ] )
39
40 Associate arbitrary parameters with this object.
41
42 If neither $name nor $value given, return a hashref of all parameters
43 set in object:
44
45 my $params = $object->param();
46 while ( my ( $name, $value ) = each %{ $params } ) {
47 print "$name = $params->{ $name }\n";
48 }
49
50 If $name given and it is a hash reference, assign all the values of the
51 reference to the object parameters. This is the way to assign multiple
52 parameters at once. Note that these will overwrite any existing
53 parameter values. Return a hashref of all parameters set in object.
54
55 $object->param({ foo => 'bar',
56 baz => 'blarney' });
57
58 If $name given and it is not a hash reference, return the value
59 associated with it, "undef" if $name was not previously set.
60
61 my $value = $object->param( 'foo' );
62 print "Value of 'foo' is '$value'\n";
63
64 If $name and $value given, associate $name with $value, overwriting any
65 existing value, and return the new value.
66
67 $object->param( foo => 'blurney' );
68
69 delete_param( [ $name ] )
70
71 Delete parameters from this object.
72
73 If $name given and it is an array reference, then delete all parameters
74 from this object. All deleted parameters will be returned as a hash
75 reference together with their values.
76
77 my $deleted = $object->delete_param(['foo','baz']);
78 foreach my $key (keys %{$deleted})
79 {
80 print $key."::=".$deleted->{$key}."\n";
81 }
82
83 If $name given and it is not an array reference, delete the parameter
84 and return the value of the parameter.
85
86 my $value = $object->delete_param( 'foo' );
87 print "Value of 'foo' was '$value'\n";
88
89 If $name is not defined or $name does not exists the undef is returned.
90
91 clear_params()
92
93 Clears out all parameters associated with this object.
94
95 normalize_array( \@array | $item )
96
97 If given "\@array" return it dereferenced; if given $item, return it in
98 a list. If given neither return an empty list.
99
101 Copyright (c) 2003-2022 Chris Winters. All rights reserved.
102
103 This library is free software; you can redistribute it and/or modify it
104 under the same terms as Perl itself.
105
106 Please see the LICENSE
107
109 Please see Workflow
110
111
112
113perl v5.36.0 2023-01-20 Workflow::Base(3)