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