JSON-RPC-Simple

 view release on metacpan or  search on metacpan

lib/JSON/RPC/Simple/Dispatcher.pm  view on Meta::CPAN

    
    # Find target
    my $target = $self->{target}->{$path};
    
    # Decode the call and trap errors because it might
    # be invalid JSON
    my $call;
    eval {
        my $content = $request->content;

        # Remove utf-8 BOM if present
        $content =~ s/^(?:\xef\xbb\xbf|\xfe\xff|\xff\xfe)//;
        
        $call = $self->json->decode($content);
    };
    if ($@) {
        $self->{errstr} = "$@";
        $self->{errobj} = $@;
        return $self->_error(
            $request, undef, 0, $self->errstr, undef, undef, $target
        );

lib/JSON/RPC/Simple/Dispatcher.pm  view on Meta::CPAN

=item content_length

The Content-Length header from the request.

=item content

The content of the request as we only handle POST.

=back

The content is stripped from any unicode BOM before being passed to the JSON 
decoder. 

=back

=cut



( run in 0.438 second using v1.01-cache-2.11-cpan-e9daa2b36ef )