line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DNS::BL::cmds::connect; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1612
|
use DNS::BL; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
56
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
79
|
use 5.006001; |
|
2
|
|
|
|
|
101
|
|
|
2
|
|
|
|
|
99
|
|
6
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
7
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
96
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use vars qw/@ISA/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
149
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
@ISA = qw/DNS::BL::cmds/; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
13
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
378
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.00_01'; |
16
|
|
|
|
|
|
|
$VERSION = eval $VERSION; # see L |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Preloaded methods go here. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=pod |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 NAME |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
DNS::BL::cmds::connect - Implement the connect command for DNS::BL |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use DNS::BL::cmds::connect; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This module implements the connect command, to be used by |
33
|
|
|
|
|
|
|
L. This command uses a backend class to perform low level |
34
|
|
|
|
|
|
|
operations on the L stable storage. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
The following methods are implemented by this module: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=over |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item C<-Eexecute()> |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
See L for information on this method's purpose. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The connect command follows a syntax such as |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
connect ... |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Where must be defined in a class such as |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
DNS::BL::cmds::connect:: |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This class will be C |
53
|
|
|
|
|
|
|
following the same protocol outlined in L. The B |
54
|
|
|
|
|
|
|
token will be removed before invoking the C method of the |
55
|
|
|
|
|
|
|
specific class. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Any prior C information will be destroyed before attempting |
58
|
|
|
|
|
|
|
the C |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub execute |
63
|
|
|
|
|
|
|
{ |
64
|
1
|
|
|
1
|
1
|
2
|
my $bl = shift; |
65
|
1
|
|
|
|
|
2
|
my $command = shift; |
66
|
|
|
|
|
|
|
|
67
|
1
|
50
|
|
|
|
4
|
unless (@_) |
68
|
|
|
|
|
|
|
{ |
69
|
0
|
0
|
|
|
|
0
|
return wantarray ? (&DNS::BL::DNSBL_ESYNTAX(), |
70
|
|
|
|
|
|
|
"Must supply a back end type (dbi, etc)") |
71
|
|
|
|
|
|
|
: &DNS::BL::DNSBL_ESYNTAX(); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
2
|
my $type = shift; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Start by removing any previous handler. _connect is used to store |
77
|
|
|
|
|
|
|
# a possible reference to an object or handle |
78
|
|
|
|
|
|
|
{ |
79
|
2
|
|
|
2
|
|
11
|
no strict 'refs'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
285
|
|
|
1
|
|
|
|
|
1
|
|
80
|
1
|
|
|
|
|
6
|
$bl->set('_' . $_, undef) for qw(_connect read match write |
81
|
|
|
|
|
|
|
erase commit); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Attempt to load the required module |
85
|
1
|
|
|
1
|
|
56
|
eval "use " . __PACKAGE__ . "::$type;"; |
|
1
|
|
|
|
|
1149
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
1
|
50
|
|
|
|
6
|
if ($@) |
88
|
|
|
|
|
|
|
{ |
89
|
1
|
50
|
|
|
|
19
|
return wantarray ? (&DNS::BL::DNSBL_ESYNTAX(), |
90
|
|
|
|
|
|
|
"Failed to connect to $type: $@") |
91
|
|
|
|
|
|
|
: &DNS::BL::DNSBL_ESYNTAX(); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# If succesful, eat the 'connect' token and pass control |
96
|
|
|
|
|
|
|
# to the corresponding class |
97
|
|
|
|
|
|
|
{ |
98
|
2
|
|
|
2
|
|
18
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
193
|
|
|
0
|
|
|
|
|
0
|
|
99
|
0
|
|
|
|
|
0
|
my $name = __PACKAGE__ . "::${type}::execute"; |
100
|
0
|
|
|
|
|
0
|
return *{$name}->($bl, $type, @_); |
|
0
|
|
|
|
|
0
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
}; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
__END__ |