Data::Walk::Extracted::Dispatch - Dispatch table management
package Data::Walk::Extracted; use Moose; with 'Data::Walk::Extracted::Dispatch'; my $main_down_level_data ={ ###### Purpose: Used to build the generic elements of the next passed ref down ###### Recieves: the upper ref value ###### Returns: the lower ref value or undef name => '- Extracted - main down level data', DEFAULT => sub{ undef }, before_method => sub{ return $_[1] }, after_method => sub{ return $_[1] }, branch_ref => \&_main_down_level_branch_ref, }; for my $key ( keys %$upper_ref ){ my $return = $self->_dispatch_method( $main_down_level_data, $key, $upper_ref->{$key}, ); $lower_ref->{$key} = $return if defined $return; } ### this example will not run on it's own it just demonstrates usage!
This role only serves the purpose of standardizing the handling of dispatch tables. It will first attempt to call the passed dispatch call. If it cannot find it then it will attempt a 'DEFAULT' call after which it will 'confess' to failure.
Definition: To make a class extensible, the majority of the decision points can be managed by (hash) dispatch tables. In order to have the dispatch behavior common across all methods this role can be attached to the class to provided for common dispatching. If the hash key requested is not available then the dispatch method will attempt to call 'DEFAULT'. If both fail the method will 'confess'.
Accepts: This method expects to be called by $self. It first receives the dispatch table (hash) as a data reference. Next, the target hash key is accepted as $call. Finally, any arguments needed by the dispatch table are passed through in @arg_list. if the dispatch table has a name => key the value will be used in any confessed error message.
Returns: defined by the dispatch (hash) table
1. Nothing yet!
github Data-Walk-Extracted/issues
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
This software is copyrighted (c) 2013, 2016 by Jed Lund.
version
utf8
Carp - confess
Moose::Role
Log::Shiras::Unhide - Can use to unhide '###InternalExtracteDDispatcH' tags
Log::Shiras::TapWarn - to manage the output of exposed '###InternalExtracteDDispatcH' lines
Data::Walk::Extracted
To install Data::Walk::Extracted, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Walk::Extracted
CPAN shell
perl -MCPAN -e shell install Data::Walk::Extracted
For more information on module installation, please visit the detailed CPAN module installation guide.