NAME

OpenFrame::WebApp::Factory - abstract factory class

SYNOPSIS

# abstract class - must override to use
use OpenFrame::WebApp::Factory::Foo;

my $factory = new OpenFrame::WebApp::Factory::Foo()->type('bar');

my $obj = $factory->new_object( @args );

DESCRIPTION

The OpenFrame::WebApp::Factory class is an abstract implementation of the factory design pattern. On creating a new factory you can specify the type of object it should create. Then you can ask the factory to create new objects of this type for you.

METHODS

$obj->type

set/get object type. this is usually a mnemonic string, but it could even be a class name. how type is interpreted depends on the implementation.

$class = $obj->get_types_class()

abstract method to get the class associated with type().

$class = $obj->load_types_class()

load the class associated with type() if it has no new() method. throws OpenFrame::WebApp::Error::LoadClass if there was a problem loading the class.

$new_obj = $obj->new_object( ... )

creates a new object of the apprpriate class. passes all arguments on to the new() method in this class. tries to load the types class first.

AUTHOR

Steve Purkis <spurkis@epn.nu>

COPYRIGHT

Copyright (c) 2003 Steve Purkis. All rights reserved. Released under the same license as Perl itself.

SEE ALSO

OpenFrame::WebApp