Author image James Spurin
and 1 contributors

NAME

Dispatch::Profile::CodeStore - Dispatch::Profile coderef store

VERSION

version 0.002

DESCRIPTION

This module provides a Moose BUILD constructor that is utilised by the Dispatch::Profile package. It is responsible for parsing the supplied profile and storing the associated target code references.

BUILD

Moose constructor with the following configurable parameters

class_loader => 'String'

A string containing a module to load at runtime

  class_loader => 'Data::Dumper'

class_loader => [ 'String', 'String' ]

Multiple modules can be loaded through an array of strings

  class_loader => [ 'Data::Dumper', 'DBI' ]

profile => HashRef

Profiles are defined through a HashRef of profile parameters

  profile => { }

profile => [ HashRef, HashRef ]

Multiple profiles can be defined through an array of hashref profile parameters

  profile => [ 
     { }, 
     { }, 
  ],

PROFILE PARAMETERS

The following parameters can be used within the profile hashref

target => 'String'

Specifies the target method for use with the profile

  profile => {
     target => 'target_method',
  }

class => 'String'

Specifies the class can be used for the associated target. When omitted, the target class should be available within the main namespace.

  profile => {
     class => 'Target::Class',
     target => 'target_method',
  }

object => Hashref

The object parameter works in conjunction with the class parameter and initialises an object for the given class. Upon dispatch, the target method is actioned against the initialised object.

  profile => {
     class => 'Target::Class',
     target => 'target_method',
     object => {
        param1 => 'entry1',
        param2 => 'entry2',
     }
  }

AUTHOR

James Spurin <james@spurin.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by James Spurin.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.