File Coverage

blib/lib/Protocol/Database/PostgreSQL/Constants.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Protocol::Database::PostgreSQL::Constants;
2              
3 1     1   257427 use strict;
  1         2  
  1         46  
4 1     1   7 use warnings;
  1         2  
  1         130  
5              
6             our $VERSION = '2.001'; # VERSION
7              
8             =head1 NAME
9              
10             Protocol::Database::PostgreSQL::Constants - some constants used in the PostgreSQL protocol
11              
12             =head1 DESCRIPTION
13              
14             Exports some constants - mostly SSL-related.
15              
16             =cut
17              
18 1     1   7 use Exporter qw(import export_to_level);
  1         3  
  1         45  
19              
20 1     1   7 use List::Util qw(uniqstr);
  1         3  
  1         178  
21              
22             =head1 EXPORTS
23              
24             (note that SSL here actually means TLS).
25              
26             =over 4
27              
28             =item * C - do not use SSL
29              
30             =item * C - use SSL if we can
31              
32             =item * C - only use SSL
33              
34             =back
35              
36             =cut
37              
38             use constant {
39 1         242 SSL_DISABLE => 0,
40             SSL_PREFER => 1,
41             SSL_REQUIRE => 2,
42 1     1   10 };
  1         2  
43              
44             =head2 SSL_NAME_MAP
45              
46             Mapping from plain text words to the C constants.
47              
48             =over 4
49              
50             =item * C
51              
52             =item * C
53              
54             =item * C
55              
56             =back
57              
58             =cut
59              
60             our %SSL_NAME_MAP = (
61             disable => SSL_DISABLE,
62             prefer => SSL_PREFER,
63             require => SSL_REQUIRE,
64             );
65              
66             our %EXPORT_TAGS = (
67             v1 => [qw(SSL_DISABLE SSL_PREFER SSL_REQUIRE)],
68             );
69             our @EXPORT_OK = uniqstr map { @$_ } values %EXPORT_TAGS;
70              
71             1;
72              
73             __END__