Chris Winters > Workflow-0.17 > Workflow::Base

Download:
Workflow-0.17.tar.gz

Dependencies

Annotate this POD (1)

CPAN RT

New  6
Open  1
View/Report Bugs
Module Version: 1.05   Source   Latest Release: Workflow-1.40

NAME ^

Workflow::Base - Base class with constructor

SYNOPSIS ^

 package My::App::Foo;
 use base qw( Workflow::Base );

DESCRIPTION ^

Provide a constructor and some other useful methods for subclasses.

METHODS ^

Class Methods

new( @params )

Just create a new object (blessed hashref) and pass along @params to the init() method, which subclasses can override to initialize themselves.

Returns: new object

Object Methods

init( @params )

Subclasses may implement to do initialization. The @params are whatever is passed into new(). Nothing need be returned.

param( [ $name, $value ] )

Associate arbitrary parameters with this object.

If neither $name nor $value given, return a hashref of all parameters set in object:

 my $params = $object->param();
 while ( my ( $name, $value ) = each %{ $params } ) {
     print "$name = $params->{ $name }\n";
 }

If $name given and it is a hash reference, assign all the values of the reference to the object parameters. This is the way to assign multiple parameters at once. Note that these will overwrite any existing parameter values. Return a hashref of all parameters set in object.

 $object->param({ foo => 'bar',
                  baz => 'blarney' });

If $name given and it is not a hash reference, return the value associated with it, undef if $name was not previously set.

 my $value = $object->param( 'foo' );
 print "Value of 'foo' is '$value'\n";

If $name and $value given, associate $name with $value, overwriting any existing value, and return the new value.

 $object->param( foo => 'blurney' );

clear_params()

Clears out all parameters associated with this object.

normalize_array( \@array | $item )

If given \@array return it dereferenced; if given $item, return it in a list. If given neither return an empty list.

COPYRIGHT ^

Copyright (c) 2003-2004 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.

AUTHORS ^

Chris Winters <chris@cwinters.com>

syntax highlighting: