View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Jed Lund > Data-Walk-Extracted > Data::Walk::Extracted::Dispatch



Annotate this POD


View/Report Bugs
Module Version: v0.28.0   Source  


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.

Methods ^

_dispatch_method( $dispatch_ref, $call, @arg_list ) - internal

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


Jed Lund


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.

Dependencies ^



Carp - confess



Log::Shiras::Unhide - Can use to unhide '###InternalExtracteDDispatcH' tags

Log::Shiras::TapWarn - to manage the output of exposed '###InternalExtracteDDispatcH' lines


syntax highlighting: