Sha256: 8699ec159518fce418450693cc753588229c7257692af868911261afa933ace4
Contents?: true
Size: 1.08 KB
Versions: 10
Compression:
Stored size: 1.08 KB
Contents
package Javonet::Core::Handler::CommandHandler::GetTypeHandler; use aliased 'Javonet::Core::Handler::PerlHandler' => 'PerlHandler'; use strict; use warnings FATAL => 'all'; use Moose; use lib 'lib'; use lib 'data_seed'; use Nice::Try; use aliased 'Javonet::Core::Handler::Exception' => 'Exception'; extends 'Javonet::Core::Handler::CommandHandler::AbstractCommandHandler'; sub new { my $class = shift; my $self = { required_parameters_count => 1 }; return bless $self, $class; } sub process { my ($self, $command) = @_; try { my $current_payload_ref = $command->{payload}; my @cur_payload = @$current_payload_ref; my $parameters_length = @cur_payload; if ($parameters_length != $self->{required_parameters_count}) { die Exception->new("Exception: GetTypeHandler parameters mismatch"); } my $class_name = $command->{payload}[0]; no strict 'refs'; eval("use $class_name;"); my $var = ${class_name}; return $var; } catch ( $e ) { return $e; } } no Moose; 1;
Version data entries
10 entries across 5 versions & 1 rubygems