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.08 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 param( [ $name, $value ] )
35
36 Associate arbitrary parameters with this object.
37
38 If neither $name nor $value given, return a hashref of all parameters
39 set in object:
40
41 my $params = $object->param();
42 while ( my ( $name, $value ) = each %{ $params } ) {
43 print "$name = $params->{ $name }\n";
44 }
45
46 If $name given and it is a hash reference, assign all the values of the
47 reference to the object parameters. This is the way to assign multiple
48 parameters at once. Note that these will overwrite any existing
49 parameter values. Return a hashref of all parameters set in object.
50
51 $object->param({ foo => 'bar',
52 baz => 'blarney' });
53
54 If $name given and it is not a hash reference, return the value
55 associated with it, "undef" if $name was not previously set.
56
57 my $value = $object->param( 'foo' );
58 print "Value of 'foo' is '$value'\n";
59
60 If $name and $value given, associate $name with $value, overwriting any
61 existing value, and return the new value.
62
63 $object->param( foo => 'blurney' );
64
65 delete_param( [ $name ] )
66
67 Delete parameters from this object.
68
69 If $name given and it is an array reference, then delete all parameters
70 from this object. All deleted parameters will be returned as a hash
71 reference together with their values.
72
73 my $deleted = $object->delete_param(['foo','baz']);
74 foreach my $key (keys %{$deleted})
75 {
76 print $key."::=".$deleted->{$key}."\n";
77 }
78
79 If $name given and it is not an array reference, delete the parameter
80 and return the value of the parameter.
81
82 my $value = $object->delete_param( 'foo' );
83 print "Value of 'foo' was '$value'\n";
84
85 If $name is not defined or $name does not exists the undef is returned.
86
87 clear_params()
88
89 Clears out all parameters associated with this object.
90
91 normalize_array( \@array | $item )
92
93 If given "\@array" return it dereferenced; if given $item, return it in
94 a list. If given neither return an empty list.
95
97 Copyright (c) 2003-2004 Chris Winters. All rights reserved.
98
99 This library is free software; you can redistribute it and/or modify it
100 under the same terms as Perl itself.
101
103 Chris Winters <chris@cwinters.com>
104
105
106
107perl v5.32.0 2020-07-28 Workflow::Base(3)