File: RequireEncodingWithUTF8Layer.run

package info (click to toggle)
libperl-critic-perl 1.148-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,532 kB
  • sloc: perl: 24,116; lisp: 341; makefile: 7
file content (156 lines) | stat: -rw-r--r-- 3,767 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
## name basic failures
## failures 33
## cut

open $fh, ">:utf8", $output;
open($fh, ">:utf8", $output);
open($fh, ">:utf8", $output) or die;

open my $fh, ">:utf8", $output;
open(my $fh, ">:utf8", $output);
open(my $fh, ">:utf8", $output) or die;

open FH, ">:utf8", $output;
open(FH, ">:utf8", $output);
open(FH, ">:utf8", $output) or die;

#This are tricky because the Critic can't
#tell where the expression really ends
open FH, ">:utf8", $output or die;
open $fh, ">:utf8", $output or die;
open my $fh, ">:utf8", $output or die;

# Other file modes
open $fh, "<:utf8", $output;
open $fh, ">>:utf8", $output;
open $fh, "+>:utf8", $output;
open $fh, "+<:utf8", $output;
open $fh, "+>>:utf8", $output;

# binmode()

binmode $fh, ":utf8";
binmode($fh, ":utf8");
binmode($fh, ":utf8") or die;

binmode FH, ":utf8";
binmode(FH, ":utf8");
binmode(FH, ":utf8") or die;

#This are tricky because the Critic can't
#tell where the expression really ends
binmode FH, ":utf8" or die;
binmode $fh, ":utf8" or die;

binmode $fh, "utf8";
binmode($fh, "utf8");
binmode($fh, "utf8") or die;

binmode FH, "utf8";
binmode(FH, "utf8");
binmode(FH, "utf8") or die;

#This are tricky because the Critic can't
#tell where the expression really ends
binmode FH, "utf8" or die;
binmode $fh, "utf8" or die;

#-----------------------------------------------------------------------------

## name basic passes
## failures 0
## cut

open $fh, ">$output";
open($fh, ">$output");
open($fh, ">$output") or die;

open my $fh, ">$output";
open(my $fh, ">$output");
open(my $fh, ">$output") or die;

open FH, ">$output";
open(FH, ">$output");
open(FH, ">$output") or die;

#This are tricky because the Critic can't
#tell where the expression really ends
open $fh, ">$output" or die;
open my $fh, ">$output" or die;
open FH, ">$output" or die;

open $fh, '>', $output;
open($fh, '>', $output);
open($fh, '>', $output) or die;

open my $fh, '>', $output;
open(my $fh, '>', $output);
open(my $fh, '>', $output) or die;

open FH, '>', $output;
open(FH, '>', $output);
open(FH, '>', $output) or die;

#This are tricky because the Critic can't
#tell where the expression really ends
open $fh, '>', $output or die;
open my $fh, '>', $output or die;
open FH, '>', $output or die;

open $fh, '>:encoding(utf8)', $output;
open($fh, '>:encoding(utf8)', $output);
open($fh, '>:encoding(utf8)', $output) or die;

open my $fh, '>:encoding(utf8)', $output;
open(my $fh, '>:encoding(utf8)', $output);
open(my $fh, '>:encoding(utf8)', $output) or die;

open FH, '>:encoding(utf8)', $output;
open(FH, '>:encoding(utf8)', $output);
open(FH, '>:encoding(utf8)', $output) or die;

#This are tricky because the Critic can't
#tell where the expression really ends
open $fh, '>:encoding(utf8)', $output or die;
open my $fh, '>:encoding(utf8)', $output or die;
open FH, '>:encoding(utf8)', $output or die;

# binmode

binmode $fh;
binmode($fh);
binmode($fh) or die;

binmode FH;
binmode(FH);
binmode(FH) or die;

#This are tricky because the Critic can't
#tell where the expression really ends
binmode $fh or die;
binmode FH or die;

binmode $fh, ':encoding(utf8)';
binmode($fh, ':encoding(utf8)');
binmode($fh, ':encoding(utf8)') or die;

binmode FH, ':encoding(utf8)';
binmode(FH, ':encoding(utf8)');
binmode(FH, ':encoding(utf8)') or die;

#This are tricky because the Critic can't
#tell where the expression really ends
binmode $fh, ':encoding(utf8)' or die;
binmode FH, ':encoding(utf8)' or die;

$foo{open}; # not a function call

#-----------------------------------------------------------------------------
# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :