PostgreSQL/Backend/ErrorResponse.pm

filter: Statementstmt 54.8% 17 / 31 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 62.5% 5 / 8 Podpod 33.3% 1 / 3 totaltotal 43.4% 23 / 53 CC 5 SCAR 25.8
CC
5
Cov
42%
new_from_message
30.0
type
2.0
error
2.0
CRAP 13.2
« PostgreSQL/Backend/AuthenticationRequest.pm ↑ Summary PostgreSQL.pm »
1 package Protocol::Database::PostgreSQL::Backend::ErrorResponse;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 our $VERSION = '2.000'; # VERSION
7  
8 4 ▶use parent qw(Protocol::Database::PostgreSQL::Backend);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 Protocol::Database::PostgreSQL::Backend::ErrorResponse
13  
14 =head1 DESCRIPTION
15  
16 =cut
17  
18 4 ▶use Protocol::Database::PostgreSQL::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 0 ▶sub type { 'error_response' }
Subroutine type: not called CC=1 SCAR=6.9
Pod undocumented
22  
23 0 ▶sub error { shift->{error} }
Subroutine error: not called CC=1 SCAR=6.9
Pod undocumented
24  
25 sub new_from_message {
26 0 ▶ my ($class, $msg) = @_;
Subroutine new_from_message: not called CC=5 SCAR=34.0
Pod documented
27 0 (undef, my $size) = unpack('C1N1', $msg);
28 0 substr $msg, 0, 5, '';
29 0 my %notice;
30 FIELD:
31 0 ▶ while(length($msg)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $msg) 0 0 0
32 0 my ($code, $str) = unpack('A1Z*', $msg);
33 0 ▶ last FIELD unless $code && $code ne "\0";
Branch: 1 branch
BranchTrueFalseTotal
unless $code and $code ne "\0" 0 0 0
Condition0%0/3
$code and $code ne "\0"
!ll&&!rl&&r
000
MC/DC0%0/2
$code and $code ne "\0"
$code $code ne "\0"
Truth table0%0/3
A and B
A= $codeB= $code ne "\0"
ABresult
0X0
100
111
34  
35 0 ▶ die "Unknown NOTICE code [$code]" unless exists $Protocol::Database::PostgreSQL::NOTICE_CODE{$code};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Protocol::Database::PostgreSQL::NOTICE_CODE{$code} 0 0 0
36 0 $notice{$Protocol::Database::PostgreSQL::NOTICE_CODE{$code}} = $str;
37 0 substr $msg, 0, 2+length($str), '';
38 }
39 0 $log->tracef("Error was %s", \%notice);
40 0 return $class->new(
41 error => Protocol::Database::PostgreSQL::Error->new(%notice)
42 );
43 }
44  
45 4 1;
46  
47 =head1 AUTHOR
48  
49 Tom Molesworth <TEAM@cpan.org>
50  
51 =head1 LICENSE
52  
53 Copyright Tom Molesworth 2010-2019. Licensed under the same terms as Perl itself.
54  
« PostgreSQL/Backend/AuthenticationRequest.pm ↑ Summary PostgreSQL.pm »