JSORB::Dispatcher::Catalyst::WithInvocant - A Catalyst dispatcher for invocants


JSORB documentation Contained in the JSORB distribution.

Index


Code Index:

NAME

Top

JSORB::Dispatcher::Catalyst::WithInvocant - A Catalyst dispatcher for invocants

DESCRIPTION

Top

Very similar to JSORB::Dispatcher::Catalyst but handles the creation of object invocants for each request.

BUGS

Top

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.

AUTHOR

Top

Stevan Little <stevan.little@iinteractive.com>

COPYRIGHT AND LICENSE

Top


JSORB documentation Contained in the JSORB distribution.

package JSORB::Dispatcher::Catalyst::WithInvocant;
use Moose;

our $VERSION   = '0.04';
our $AUTHORITY = 'cpan:STEVAN';

extends 'JSORB::Dispatcher::Path';
   with 'JSORB::Dispatcher::Traits::WithInvocantFactory';

has 'constructor_arg_generators' => (
    is      => 'ro',
    isa     => 'HashRef[CodeRef]',   
    default => sub { {} },
);

sub prepare_handler_args {
    my ($self, $call, $c) = @_;
    
    my $procedure = $self->get_procedure_from_call($call);
    return unless defined $procedure;
    
    my $constructor_generator = $self->constructor_arg_generators->{ $procedure->class_name };
    return unless defined $constructor_generator;
    
    return $constructor_generator->($c);
}

__PACKAGE__->meta->make_immutable;

no Moose; 1;

__END__