blob: f61da1a8e18944635f2c37e28ad6896f3823bb46 (
plain)
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
pp_ctl.c AOK
Not enough format arguments
format STDOUT =
@<<< @<<<
$a
.
write;
Exiting substitution via %s
$_ = "abc" ;
while ($i ++ == 0)
{
s/ab/last/e ;
}
Exiting subroutine via %s
sub fred { last }
{ fred() }
Exiting eval via %s
{ eval "last" }
Exiting pseudo-block via %s
@a = (1,2) ; @b = sort { last } @a ;
Exiting substitution via %s
$_ = "abc" ;
last fred:
while ($i ++ == 0)
{
s/ab/last fred/e ;
}
Exiting subroutine via %s
sub fred { last joe }
joe: { fred() }
Exiting eval via %s
fred: { eval "last fred" }
Exiting pseudo-block via %s
@a = (1,2) ; fred: @b = sort { last fred } @a ;
Deep recursion on subroutine \"%s\"
sub fred
{
fred() if $a++ < 200
}
fred()
(in cleanup) foo bar
package Foo;
DESTROY { die "foo bar" }
{ bless [], 'Foo' for 1..10 }
__END__
# pp_ctl.c
use warnings 'syntax' ;
format STDOUT =
@<<< @<<<
1
.
write;
EXPECT
Not enough format arguments at - line 5.
1
########
# pp_ctl.c
no warnings 'syntax' ;
format =
@<<< @<<<
1
.
write ;
EXPECT
1
########
# pp_ctl.c
use warnings 'unsafe' ;
$_ = "abc" ;
while ($i ++ == 0)
{
s/ab/last/e ;
}
no warnings 'unsafe' ;
while ($i ++ == 0)
{
s/ab/last/e ;
}
EXPECT
Exiting substitution via last at - line 7.
########
# pp_ctl.c
use warnings 'unsafe' ;
sub fred { last }
{ fred() }
no warnings 'unsafe' ;
sub joe { last }
{ joe() }
EXPECT
Exiting subroutine via last at - line 3.
########
# pp_ctl.c
{
eval "use warnings 'unsafe' ; last;"
}
print STDERR $@ ;
{
eval "no warnings 'unsafe' ;last;"
}
print STDERR $@ ;
EXPECT
Exiting eval via last at (eval 1) line 1.
########
# pp_ctl.c
use warnings 'unsafe' ;
@a = (1,2) ;
@b = sort { last } @a ;
no warnings 'unsafe' ;
@b = sort { last } @a ;
EXPECT
Exiting pseudo-block via last at - line 4.
Can't "last" outside a loop block at - line 4.
########
# pp_ctl.c
use warnings 'unsafe' ;
$_ = "abc" ;
fred:
while ($i ++ == 0)
{
s/ab/last fred/e ;
}
no warnings 'unsafe' ;
while ($i ++ == 0)
{
s/ab/last fred/e ;
}
EXPECT
Exiting substitution via last at - line 7.
########
# pp_ctl.c
use warnings 'unsafe' ;
sub fred { last joe }
joe: { fred() }
no warnings 'unsafe' ;
sub Fred { last Joe }
Joe: { Fred() }
EXPECT
Exiting subroutine via last at - line 3.
########
# pp_ctl.c
joe:
{ eval "use warnings 'unsafe' ; last joe;" }
print STDERR $@ ;
Joe:
{ eval "no warnings 'unsafe' ; last Joe;" }
print STDERR $@ ;
EXPECT
Exiting eval via last at (eval 1) line 1.
########
# pp_ctl.c
use warnings 'unsafe' ;
@a = (1,2) ;
fred: @b = sort { last fred } @a ;
no warnings 'unsafe' ;
Fred: @b = sort { last Fred } @a ;
EXPECT
Exiting pseudo-block via last at - line 4.
Label not found for "last fred" at - line 4.
########
# pp_ctl.c
use warnings 'recursion' ;
BEGIN { warn "PREFIX\n" ;}
sub fred
{
fred() if $a++ < 200
}
fred()
EXPECT
Deep recursion on subroutine "main::fred" at - line 6.
########
# pp_ctl.c
no warnings 'recursion' ;
BEGIN { warn "PREFIX\n" ;}
sub fred
{
fred() if $a++ < 200
}
fred()
EXPECT
########
# pp_ctl.c
use warnings 'unsafe' ;
package Foo;
DESTROY { die "@{$_[0]} foo bar" }
{ bless ['A'], 'Foo' for 1..10 }
{ bless ['B'], 'Foo' for 1..10 }
EXPECT
(in cleanup) A foo bar at - line 4.
(in cleanup) B foo bar at - line 4.
########
# pp_ctl.c
no warnings 'unsafe' ;
package Foo;
DESTROY { die "@{$_[0]} foo bar" }
{ bless ['A'], 'Foo' for 1..10 }
{ bless ['B'], 'Foo' for 1..10 }
EXPECT
|