line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pg::SQL::PrettyPrinter::Node::RowExpr; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# UTF8 boilerplace, per http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/ |
4
|
4
|
|
|
4
|
|
2844
|
use v5.26; |
|
4
|
|
|
|
|
17
|
|
5
|
4
|
|
|
4
|
|
30
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
92
|
|
6
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
122
|
|
7
|
4
|
|
|
4
|
|
21
|
use warnings qw( FATAL utf8 ); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
173
|
|
8
|
4
|
|
|
4
|
|
43
|
use utf8; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
32
|
|
9
|
4
|
|
|
4
|
|
125
|
use open qw( :std :utf8 ); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
22
|
|
10
|
4
|
|
|
4
|
|
570
|
use Unicode::Normalize qw( NFC ); |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
247
|
|
11
|
4
|
|
|
4
|
|
27
|
use Unicode::Collate; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
140
|
|
12
|
4
|
|
|
4
|
|
23
|
use Encode qw( decode ); |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
287
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
if ( grep /\P{ASCII}/ => @ARGV ) { |
15
|
|
|
|
|
|
|
@ARGV = map { decode( 'UTF-8', $_ ) } @ARGV; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# If there is __DATA__,then uncomment next line: |
19
|
|
|
|
|
|
|
# binmode( DATA, ':encoding(UTF-8)' ); |
20
|
|
|
|
|
|
|
# UTF8 boilerplace, per http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/ |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Useful common code |
23
|
4
|
|
|
4
|
|
906
|
use autodie; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
24
|
|
24
|
4
|
|
|
4
|
|
22067
|
use Carp qw( carp croak confess cluck ); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
325
|
|
25
|
4
|
|
|
4
|
|
30
|
use English qw( -no_match_vars ); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
28
|
|
26
|
4
|
|
|
4
|
|
1516
|
use Data::Dumper qw( Dumper ); |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
858
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# give a full stack dump on any untrapped exceptions |
29
|
|
|
|
|
|
|
local $SIG{ __DIE__ } = sub { |
30
|
|
|
|
|
|
|
confess "Uncaught exception: @_" unless $^S; |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# now promote run-time warnings into stackdumped exceptions |
34
|
|
|
|
|
|
|
# *unless* we're in an try block, in which |
35
|
|
|
|
|
|
|
# case just generate a clucking stackdump instead |
36
|
|
|
|
|
|
|
local $SIG{ __WARN__ } = sub { |
37
|
|
|
|
|
|
|
if ( $^S ) { cluck "Trapped warning: @_" } |
38
|
|
|
|
|
|
|
else { confess "Deadly warning: @_" } |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Useful common code |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
4
|
|
31
|
use parent qw( Pg::SQL::PrettyPrinter::Node ); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
25
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
15
|
|
|
15
|
1
|
396
|
my $class = shift; |
47
|
15
|
|
|
|
|
63
|
my $self = $class->SUPER::new( @_ ); |
48
|
15
|
|
|
|
|
30
|
bless $self, $class; |
49
|
|
|
|
|
|
|
|
50
|
15
|
|
|
|
|
72
|
$self->objectify( 'args' ); |
51
|
|
|
|
|
|
|
|
52
|
15
|
|
|
|
|
36
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub as_text { |
56
|
21
|
|
|
21
|
1
|
43
|
my $self = shift; |
57
|
21
|
|
|
|
|
35
|
return sprintf( '( %s )', join( ', ', map { $_->as_text } @{ $self->{ 'args' } } ) ); |
|
46
|
|
|
|
|
118
|
|
|
21
|
|
|
|
|
48
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub pretty_print { |
61
|
9
|
|
|
9
|
1
|
20
|
my $self = shift; |
62
|
9
|
|
|
|
|
52
|
my $text = $self->as_text; |
63
|
9
|
100
|
|
|
|
51
|
return $text if length( $text ) < 40; |
64
|
1
|
|
|
|
|
4
|
my @lines = (); |
65
|
1
|
|
|
|
|
2
|
push @lines, '('; |
66
|
1
|
|
|
|
|
2
|
push @lines, map { $self->increase_indent( $_->pretty_print ) . ',' } @{ $self->{ 'args' } }; |
|
2
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
3
|
|
67
|
1
|
|
|
|
|
5
|
$lines[ -1 ] =~ s/,\z//; |
68
|
1
|
|
|
|
|
3
|
push @lines, ')'; |
69
|
1
|
|
|
|
|
5
|
return join( "\n", @lines ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# vim: set ft=perl: |