line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::TCLink; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
624
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
5
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
268
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
require DynaLoader; |
9
|
|
|
|
|
|
|
require AutoLoader; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
@ISA = qw(Exporter DynaLoader); |
12
|
|
|
|
|
|
|
@EXPORT = qw( |
13
|
|
|
|
|
|
|
PARAM_MAX_LEN |
14
|
|
|
|
|
|
|
TCLinkHandle |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
$VERSION = '3.4'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub AUTOLOAD { |
19
|
0
|
|
|
0
|
|
0
|
my $constname; |
20
|
0
|
|
|
|
|
0
|
($constname = $AUTOLOAD) =~ s/.*:://; |
21
|
0
|
0
|
|
|
|
0
|
croak "& not defined" if $constname eq 'constant'; |
22
|
0
|
0
|
|
|
|
0
|
my $val = constant($constname, @_ ? $_[0] : 0); |
23
|
0
|
0
|
|
|
|
0
|
if ($! != 0) { |
24
|
0
|
0
|
|
|
|
0
|
if ($! =~ /Invalid/) { |
25
|
0
|
|
|
|
|
0
|
$AutoLoader::AUTOLOAD = $AUTOLOAD; |
26
|
0
|
|
|
|
|
0
|
goto &AutoLoader::AUTOLOAD; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
0
|
|
|
|
|
0
|
croak "Your vendor has not defined Net::TCLink macro $constname"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
309
|
|
33
|
0
|
|
|
0
|
|
0
|
*$AUTOLOAD = sub () { $val }; |
|
0
|
|
|
|
|
0
|
|
34
|
0
|
|
|
|
|
0
|
goto &$AUTOLOAD; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
bootstrap Net::TCLink $VERSION; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub send |
40
|
|
|
|
|
|
|
{ |
41
|
1
|
|
|
1
|
0
|
73
|
my $params; |
42
|
|
|
|
|
|
|
|
43
|
1
|
50
|
|
|
|
5
|
if ($#_ == 0) |
44
|
|
|
|
|
|
|
{ |
45
|
1
|
|
|
|
|
3
|
$params = $_[0]; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
0
|
%$params = @_; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
13
|
my $handle = TCLinkCreate(); |
53
|
1
|
|
|
|
|
4
|
foreach (keys %$params) |
54
|
|
|
|
|
|
|
{ |
55
|
6
|
|
|
|
|
22
|
TCLinkPushParam($handle,$_,$params->{$_}); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
1860813
|
TCLinkSend($handle); |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
92
|
my %response; |
61
|
1
|
|
|
|
|
18
|
my $buf = " " x 2048; |
62
|
1
|
|
|
|
|
12
|
$buf = TCLinkGetEntireResponse($handle,$buf); |
63
|
1
|
|
|
|
|
15
|
my @parts = split/\n/,$buf; |
64
|
1
|
|
|
|
|
7
|
foreach (@parts) |
65
|
|
|
|
|
|
|
{ |
66
|
3
|
|
|
|
|
61
|
my ($name,$val) = split/=/,$_; |
67
|
3
|
|
|
|
|
16
|
$response{$name} = $val; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
22
|
TCLinkDestroy($handle); |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
19
|
return %response; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |