line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::SSLeay::MainContext; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# maintains a single instance of the Crypt::SSLeay::CTX class |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1053
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
6
|
2
|
|
|
2
|
|
10
|
use Carp (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
995
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Crypt::SSLeay::CTX; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $ctx = &main_ctx(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub main_ctx { |
13
|
4
|
|
100
|
4
|
0
|
2370
|
my $ssl_version = shift || 23; |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
|
|
7044
|
my $ctx = Crypt::SSLeay::CTX->new($ssl_version); |
16
|
4
|
50
|
|
|
|
22
|
$ctx->set_cipher_list($ENV{CRYPT_SSLEAY_CIPHER}) |
17
|
|
|
|
|
|
|
if $ENV{CRYPT_SSLEAY_CIPHER}; |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
28
|
$ctx; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my %sub_cache = ('main_ctx' => \&main_ctx ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub import { |
25
|
1
|
|
|
1
|
|
11
|
my $pkg = shift; |
26
|
1
|
|
|
|
|
4
|
my $callpkg = caller(); |
27
|
1
|
|
|
|
|
2
|
my @func = @_; |
28
|
1
|
|
|
|
|
4
|
for (@func) { |
29
|
1
|
|
|
|
|
3
|
s/^&//; |
30
|
1
|
50
|
|
|
|
6
|
Carp::croak("Can't export $_ from $pkg") if /\W/;; |
31
|
1
|
|
|
|
|
2
|
my $sub = $sub_cache{$_}; |
32
|
1
|
50
|
|
|
|
4
|
unless ($sub) { |
33
|
0
|
|
|
|
|
0
|
my $method = $_; |
34
|
0
|
|
|
|
|
0
|
$method =~ s/^main_ctx_//; # optional prefix |
35
|
0
|
|
|
0
|
|
0
|
$sub = $sub_cache{$_} = sub { $ctx->$method(@_) }; |
|
0
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
} |
37
|
2
|
|
|
2
|
|
13
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
153
|
|
38
|
1
|
|
|
|
|
1
|
*{"${callpkg}::$_"} = $sub; |
|
1
|
|
|
|
|
24
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |