Component Manager

1 minute read

This class provides methods load FlowPDF Components. It supports 2 loading strategies.

  • Local

    Local component gets loaded to current FlowPDF::ComponentManager object context. In this case, it is only possible to access it from current object.

  • Global

    In this strategy component gets loaded for whole execution context and can be accessed from any FlowPDF::ComponentManager object. This is the default.

new()

Creates a new FlowPDF::ComponentManager object.

Parameters

None

Returns

FlowPDF::ComponentManager

Usage

my $componentManager = FlowPDF::ComponentManager->new();

loadComponentLocal($componentName, $initParams)

Loads, initializes the component and returns a FlowPDF::Component

object in context of current FlowPDF::ComponentManager object.

Parameters

  • (Required)(String) Name of the component to be loaded

  • (Required)(HASH ref) init parameters for the component.

Returns

FlowPDF::Component

object

Usage

$componentManager->loadComponentLocal('FlowPDF::Component::YourComponent', {one => two});

Accepts a component name and initialization values as parameters.

loadComponent($componentName, $initParams)

Loads, initializes the component and returns a FlowPDF::Component

object in global context.

Parameters

  • (Required)(String) Name of the component to be loaded

  • (Required)(HASH ref) init parameters for the component.

Returns

FlowPDF::Component

object

Usage

$componentManager->loadComponentLocal('FlowPDF::Component::YourComponent', {one => two});

Accepts as parameters component name and initialization values.

getComponent($componentName)

Returns a FlowPDF::Component object that was previously loaded globally. For local context see getComponentLocal.

Parameters

  • (Required)(String) Component to get from global context.

Returns

FlowPDF::Component

object

Usage

my $component = $componentManager->getComponent('FlowPDF::Component::Proxy');

getComponentLocal($componentName)

Returns a FlowPDF::Component object that was previously loaded in local context.

Parameters

  • (Required)(String) Component to get from local context.

Returns

  • FlowPDF::Component:: object

Usage

my $component = $componentManager->getComponent('FlowPDF::Component::Proxy');