blib/lib/Net/TCLink.pm

filter: Statementstmt 29.2% 12 / 41 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 27.5% 16 / 58 CC 8 SCAR 26.2
CC
8
Cov
24%
AUTOLOAD
21.4
send
20.0
__ANON__
2.0
CRAP 13.8
↑ Summary TCLink.xs »
1 package Net::TCLink;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
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 0 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: not called CC=5 SCAR=30.7
19 0 my $constname;
20 0 ($constname = $AUTOLOAD) =~ s/.*:://;
21 0 ▶ croak "& not defined" if $constname eq 'constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 0 0
22 0 ▶ my $val = constant($constname, @_ ? $_[0] : 0);
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
23 0 ▶ if ($! != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($! != 0) 0 0 0
24 0 ▶ if ($! =~ /Invalid/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($! =~ /Invalid/) { } 0 0 0
25 0 $AutoLoader::AUTOLOAD = $AUTOLOAD;
26 0 goto &AutoLoader::AUTOLOAD;
27 }
28 else {
29 0 croak "Your vendor has not defined Net::TCLink macro $constname";
30 }
31 }
32 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
33 0 ▶ *$AUTOLOAD = sub () { $val };
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 0 goto &$AUTOLOAD;
35 }
36  
37 bootstrap Net::TCLink $VERSION;
38  
39 sub send
40 0 ▶{
Subroutine send: not called CC=4 SCAR=30.0
41 0 my $params;
42  
43 0 ▶ if ($#_ == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($#_ == 0) { } 0 0 0
44 {
45 0 $params = $_[0];
46 }
47 else
48 {
49 0 %$params = @_;
50 }
51  
52 0 my $handle = TCLinkCreate();
53 0 foreach (keys %$params)
54 {
55 0 TCLinkPushParam($handle,$_,$params->{$_});
56 }
57  
58 0 TCLinkSend($handle);
59  
60 0 my %response;
61 0 my $buf = " " x 2048;
62 0 $buf = TCLinkGetEntireResponse($handle,$buf);
63 0 my @parts = split/\n/,$buf;
64 0 foreach (@parts)
65 {
66 0 my ($name,$val) = split/=/,$_;
67 0 $response{$name} = $val;
68 }
69  
70 0 TCLinkDestroy($handle);
71  
72 0 return %response;
73 }
74  
75 1;
76  
77 __END__
↑ Summary TCLink.xs »