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
|
Check the lexical scoping of the say keyword.
(The actual behaviour is tested in t/op/say.t)
__END__
# No say; should be a syntax error.
use warnings;
say "Hello", "world";
EXPECT
Unquoted string "say" may clash with future reserved word at - line 3.
String found where operator expected at - line 3, near "say "Hello""
(Do you need to predeclare say?)
syntax error at - line 3, near "say "Hello""
Execution of - aborted due to compilation errors.
########
# With say, should work
use warnings;
use feature "say";
say "Hello", "world";
EXPECT
Helloworld
########
# With say, should work in eval too
use warnings;
use feature "say";
eval q(say "Hello", "world");
EXPECT
Helloworld
########
# feature out of scope; should be a syntax error.
use warnings;
{ use feature 'say'; }
say "Hello", "world";
EXPECT
Unquoted string "say" may clash with future reserved word at - line 4.
String found where operator expected at - line 4, near "say "Hello""
(Do you need to predeclare say?)
syntax error at - line 4, near "say "Hello""
Execution of - aborted due to compilation errors.
########
# 'no feature' should work
use warnings;
use feature 'say';
say "Hello", "world";
no feature;
say "Hello", "world";
EXPECT
Unquoted string "say" may clash with future reserved word at - line 6.
String found where operator expected at - line 6, near "say "Hello""
(Do you need to predeclare say?)
syntax error at - line 6, near "say "Hello""
Execution of - aborted due to compilation errors.
########
# 'no feature "say"' should work too
use warnings;
use feature 'say';
say "Hello", "world";
no feature 'say';
say "Hello", "world";
EXPECT
Unquoted string "say" may clash with future reserved word at - line 6.
String found where operator expected at - line 6, near "say "Hello""
(Do you need to predeclare say?)
syntax error at - line 6, near "say "Hello""
Execution of - aborted due to compilation errors.
|