line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pg::SQL::PrettyPrinter::Node::A_Indices; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1493
|
use v5.26; |
|
2
|
|
|
|
|
6
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
41
|
|
5
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
6
|
2
|
|
|
2
|
|
9
|
use warnings qw( FATAL utf8 ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
56
|
|
7
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
8
|
2
|
|
|
2
|
|
61
|
use open qw( :std :utf8 ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
9
|
2
|
|
|
2
|
|
261
|
use Unicode::Normalize qw( NFC ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
113
|
|
10
|
2
|
|
|
2
|
|
15
|
use Unicode::Collate; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
62
|
|
11
|
2
|
|
|
2
|
|
13
|
use Encode qw( decode ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
128
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
if ( grep /\P{ASCII}/ => @ARGV ) { |
14
|
|
|
|
|
|
|
@ARGV = map { decode( 'UTF-8', $_ ) } @ARGV; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# If there is __DATA__,then uncomment next line: |
18
|
|
|
|
|
|
|
# binmode( DATA, ':encoding(UTF-8)' ); |
19
|
|
|
|
|
|
|
# UTF8 boilerplace, per http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/ |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Useful common code |
22
|
2
|
|
|
2
|
|
417
|
use autodie; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
11
|
|
23
|
2
|
|
|
2
|
|
10905
|
use Carp qw( carp croak confess cluck ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
162
|
|
24
|
2
|
|
|
2
|
|
13
|
use English qw( -no_match_vars ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
16
|
|
25
|
2
|
|
|
2
|
|
724
|
use Data::Dumper qw( Dumper ); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
415
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# give a full stack dump on any untrapped exceptions |
28
|
|
|
|
|
|
|
local $SIG{ __DIE__ } = sub { |
29
|
|
|
|
|
|
|
confess "Uncaught exception: @_" unless $^S; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# now promote run-time warnings into stackdumped exceptions |
33
|
|
|
|
|
|
|
# *unless* we're in an try block, in which |
34
|
|
|
|
|
|
|
# case just generate a clucking stackdump instead |
35
|
|
|
|
|
|
|
local $SIG{ __WARN__ } = sub { |
36
|
|
|
|
|
|
|
if ( $^S ) { cluck "Trapped warning: @_" } |
37
|
|
|
|
|
|
|
else { confess "Deadly warning: @_" } |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Useful common code |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
2
|
|
17
|
use parent qw( Pg::SQL::PrettyPrinter::Node ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
13
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub new { |
45
|
9
|
|
|
9
|
1
|
236
|
my $class = shift; |
46
|
9
|
|
|
|
|
31
|
my $self = $class->SUPER::new( @_ ); |
47
|
9
|
|
|
|
|
15
|
bless $self, $class; |
48
|
|
|
|
|
|
|
|
49
|
9
|
|
|
|
|
19
|
my $keys_exist = grep { exists $self->{ $_ } } qw( lidx uidx ); |
|
18
|
|
|
|
|
48
|
|
50
|
9
|
50
|
|
|
|
34
|
croak( "Can't handle zero-arg A_Indices" ) if 0 == $keys_exist; |
51
|
|
|
|
|
|
|
|
52
|
9
|
|
|
|
|
30
|
$self->objectify( qw( lidx uidx ) ); |
53
|
|
|
|
|
|
|
|
54
|
9
|
100
|
|
|
|
57
|
if ( !$self->{ 'is_slice' } ) { |
55
|
3
|
50
|
|
|
|
10
|
croak( "Invalid A_Indices: isn't slice, but doesn't contain uidx!" ) unless exists $self->{ 'uidx' }; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
9
|
|
|
|
|
63
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub as_text { |
62
|
9
|
|
|
9
|
1
|
14
|
my $self = shift; |
63
|
9
|
|
|
|
|
15
|
my $lv = ''; |
64
|
9
|
|
|
|
|
15
|
my $uv = ''; |
65
|
9
|
100
|
|
|
|
23
|
$lv = $self->{ 'lidx' }->as_text if exists $self->{ 'lidx' }; |
66
|
9
|
100
|
|
|
|
25
|
$uv = $self->{ 'uidx' }->as_text if exists $self->{ 'uidx' }; |
67
|
9
|
100
|
|
|
|
23
|
if ( $self->{ 'is_slice' } ) { |
68
|
6
|
|
|
|
|
64
|
return sprintf( |
69
|
|
|
|
|
|
|
'[%s:%s]', |
70
|
|
|
|
|
|
|
$lv, |
71
|
|
|
|
|
|
|
$uv |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
} |
74
|
3
|
|
|
|
|
17
|
return sprintf( |
75
|
|
|
|
|
|
|
'[%s]', |
76
|
|
|
|
|
|
|
$uv |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub pretty_print { |
81
|
9
|
|
|
9
|
1
|
16
|
my $self = shift; |
82
|
9
|
|
|
|
|
12
|
my $lv = ''; |
83
|
9
|
|
|
|
|
12
|
my $uv = ''; |
84
|
9
|
100
|
|
|
|
27
|
$lv = $self->{ 'lidx' }->pretty_print if exists $self->{ 'lidx' }; |
85
|
9
|
100
|
|
|
|
25
|
$uv = $self->{ 'uidx' }->pretty_print if exists $self->{ 'uidx' }; |
86
|
9
|
100
|
|
|
|
24
|
if ( $self->{ 'is_slice' } ) { |
87
|
6
|
|
|
|
|
66
|
return sprintf( |
88
|
|
|
|
|
|
|
'[%s:%s]', |
89
|
|
|
|
|
|
|
$lv, |
90
|
|
|
|
|
|
|
$uv |
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
} |
93
|
3
|
|
|
|
|
16
|
return sprintf( |
94
|
|
|
|
|
|
|
'[%s]', |
95
|
|
|
|
|
|
|
$uv |
96
|
|
|
|
|
|
|
); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |