#!/usr/bin/perl -w use strict; use MIME::Base64; use JSON; use dedikit; my %RET; my $ERR; my $enc_data = shift; my $data = from_json(decode_base64($enc_data)); my $api_url = $data->{api_url}; my $db_id = $data->{db_id}; my $db_password = $data->{db_password}; my $func = $data->{func}; my $func_args = $data->{func_args}; my $funcname = "dedikit::$func"; dedikit::login(api_url => $api_url, id => $db_id, password => $db_password); if($dedikit::ERROR) { $ERR = $dedikit::ERROR; goto FINISH; } no strict 'refs'; my @result = &$funcname(%$func_args); use strict 'refs'; if($dedikit::ERROR) { $ERR = $dedikit::ERROR; goto FINISH; } $RET{result} = \@result; FINISH: $RET{ERROR} = $ERR; print encode_base64(to_json(\%RET, { latin1 => 1 } ));