File: Constants.pm

package info (click to toggle)
libjson-rpc-perl 1.06-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 264 kB
  • sloc: perl: 1,094; makefile: 587
file content (68 lines) | stat: -rw-r--r-- 1,213 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package JSON::RPC::Constants;
use strict;
use parent qw(Exporter);

our @EXPORT_OK = qw(
    JSONRPC_DEBUG
    RPC_PARSE_ERROR
    RPC_INVALID_REQUEST
    RPC_METHOD_NOT_FOUND
    RPC_INVALID_PARAMS
    RPC_INTERNAL_ERROR
);
our %EXPORT_TAGS = (all => \@EXPORT_OK);

my %constants;
BEGIN {
    %constants = (
        JSONRPC_DEBUG     => $ENV{PERL_JSONRPC_DEBUG} ? 1 : 0,
        RPC_PARSE_ERROR      => -32700,
        RPC_INVALID_REQUEST  => -32600,
        RPC_METHOD_NOT_FOUND => -32601,
        RPC_INVALID_PARAMS   => -32602,
        RPC_INTERNAL_ERROR   => -32603,
    );
    require constant;
    constant->import( \%constants );
}

1;

__END__

=head1 NAME

JSON::RPC::Constants - Constants

=head1 SYNOPSIS

    use JSON::RPC::Constants qw(:all);
    # or, import one by one

=head1 DEBUG

=over 4 

=item B<JSONRPC_DEBUG>

Set to true if PERL_JSONRPC_DEBUG environmental variable is set to a value that evaluates to true. False otherwise. 

This controls debug output of the module.

=back

=head1 JSON RPC VALUES

These values are defined as per JSON RPC RFC.

=head2 RPC_PARSE_ERROR

=head2 RPC_INVALID_REQUEST

=head2 RPC_METHOD_NOT_FOUND

=head2 RPC_INVALID_PARAMS

=head2 RPC_INTERNAL_ERROR

=cut