This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcharclass.h: #defines for non-chars by UTF8 length
[perl5.git] / t / lib / warnings / gv
CommitLineData
599cee73
PM
1 gv.c AOK
2
3 Can't locate package %s for @%s::ISA
4 @ISA = qw(Fred); joe()
5
e5e43984
FC
6 Name "main::a" used only once: possible typo
7
0453d815
PM
8 Mandatory Warnings ALL TODO
9 ------------------
599cee73 10
34ee6772 11 Had to create %SVf unexpectedly [gv_fetchpv]
0453d815
PM
12 Attempt to free unreferenced glob pointers [gp_free]
13
599cee73
PM
14__END__
15# gv.c
f40a7154 16use warnings 'syntax' ;
599cee73
PM
17@ISA = qw(Fred); joe()
18EXPECT
599cee73
PM
19Undefined subroutine &main::joe called at - line 3.
20########
21# gv.c
f40a7154 22no warnings 'syntax' ;
0453d815
PM
23@ISA = qw(Fred); joe()
24EXPECT
25Undefined subroutine &main::joe called at - line 3.
26########
27# gv.c
448aac91
MM
28use warnings 'syntax' ;
29@ISA = qw(Fred); __PACKAGE__->joe()
30EXPECT
31While trying to resolve method call main->joe() can not locate package "Fred" yet it is mentioned in @main::ISA (perhaps you forgot to load "Fred"?) at - line 3.
32Can't locate object method "joe" via package "main" at - line 3.
33########
34# gv.c
35no warnings 'syntax' ;
36@ISA = qw(Fred); __PACKAGE__->joe()
37EXPECT
38Can't locate object method "joe" via package "main" at - line 3.
39########
40# gv.c
41use warnings 'syntax' ;
42{
43 package AA; # this is a deliberate error
44# package A; # should be this
45 sub foo {
46 print STDERR "I'm in A's foo\n";
47 }
48}
49{
50 package B;
51 sub foo {
52 print STDERR "I'm in B's foo\n";
53 }
54}
55@C::ISA = qw(A B);
56$a = bless [], 'C';
57$a->foo();
58__END__
59EXPECT
60While trying to resolve method call C->foo() can not locate package "A" yet it is mentioned in @C::ISA (perhaps you forgot to load "A"?) at - line 18.
61I'm in B's foo
62########
63# gv.c
64no warnings 'syntax' ;
65{
66 package AA; # this is a deliberate error
67# package A; # should be this
68 sub foo {
69 print STDERR "I'm in A's foo\n";
70 }
71}
72{
73 package B;
74 sub foo {
75 print STDERR "I'm in B's foo\n";
76 }
77}
78@C::ISA = qw(A B);
79$a = bless [], 'C';
80$a->foo();
81__END__
82EXPECT
83I'm in B's foo
84########
85# gv.c
86use warnings 'syntax' ;
87{
88# package AA; # this would be an error
89 package A; # the right thing
90 sub foo {
91 print STDERR "I'm in A's foo\n";
92 }
93}
94{
95 package B;
96 sub foo {
97 print STDERR "I'm in B's foo\n";
98 }
99}
100@C::ISA = qw(A B);
101$a = bless [], 'C';
102$a->foo();
103__END__
104EXPECT
105I'm in A's foo
106########
107# gv.c
a15a3d9b
FC
108$a = ${^ENCODING};
109$a = ${^E_NCODING};
a15a3d9b
FC
110${^E_NCODING} = 1; # We pretend this variable never existed.
111EXPECT
a15a3d9b
FC
112########
113# gv.c
34ee6772
BF
114use warnings 'syntax' ;
115use utf8;
116use open qw( :utf8 :std );
117package Y;
118@ISA = qw(Fred); joe()
119EXPECT
34ee6772 120Undefined subroutine &Y::joe called at - line 6.
e5e43984
FC
121########
122# gv.c
123use warnings;
124$x = 1;
125if ($x) {
126 print $y;
127}
ea238638
FC
128$a++; # These two should
129$b++; # be exempt.
130$Foo::a++;
131$Foo::b++;
e5e43984
FC
132EXPECT
133Name "main::y" used only once: possible typo at - line 5.
134Use of uninitialized value $y in print at - line 5.
135########
136# gv.c
137use warnings;
138$x = 1;
139if ($x) {
140 $x++;
141 print $y;
142}
143EXPECT
144Name "main::y" used only once: possible typo at - line 6.
145Use of uninitialized value $y in print at - line 6.
146########
147# gv.c
148use warnings;
149$x = 0;
150if ($x) {
151 print "1\n";
152} elsif (!$x) {
153 print $y;
154} else {
155 print "0\n";
156}
157EXPECT
158Name "main::y" used only once: possible typo at - line 7.
159Use of uninitialized value $y in print at - line 7.
160########
161# gv.c
162use warnings;
163$x = 0;
164if ($x) {
165 print "1\n";
166} elsif (!$x) {
167 $x++;
168 print $y;
169} else {
170 print "0\n";
171}
172EXPECT
173Name "main::y" used only once: possible typo at - line 8.
174Use of uninitialized value $y in print at - line 8.
175########
176# gv.c
177use utf8;
178use open qw( :utf8 :std );
179use warnings;
180$ㄒ = 1;
181if ($ㄒ) {
182 print $ʎ;
183}
184EXPECT
185Name "main::ʎ" used only once: possible typo at - line 7.
186Use of uninitialized value $ʎ in print at - line 7.
187########
188# gv.c
189use utf8;
190use open qw( :utf8 :std );
191use warnings;
192$ㄒ = 1;
193if ($ㄒ) {
194 $ㄒ++;
195 print $ʎ;
196}
197EXPECT
198Name "main::ʎ" used only once: possible typo at - line 8.
199Use of uninitialized value $ʎ in print at - line 8.
200########
201# gv.c
202use utf8;
203use open qw( :utf8 :std );
204use warnings;
205$ㄒ = 0;
206if ($ㄒ) {
207 print "1\n";
208} elsif (!$ㄒ) {
209 print $ʎ;
210} else {
211 print "0\n";
212}
213EXPECT
214Name "main::ʎ" used only once: possible typo at - line 9.
215Use of uninitialized value $ʎ in print at - line 9.
216########
217# gv.c
218use utf8;
219use open qw( :utf8 :std );
220use warnings;
221$ㄒ = 0;
222if ($ㄒ) {
223 print "1\n";
224} elsif (!$ㄒ) {
225 $ㄒ++;
226 print $ʎ;
227} else {
228 print "0\n";
229}
230EXPECT
231Name "main::ʎ" used only once: possible typo at - line 10.
232Use of uninitialized value $ʎ in print at - line 10.
233########
234# gv.c
235use utf8;
236use open qw( :utf8 :std );
237use warnings;
238package 팣칵ぇ;
239$ㄒ = 1;
240if ($ㄒ) {
241 print $ʎ;
242}
243EXPECT
244Name "팣칵ぇ::ʎ" used only once: possible typo at - line 8.
245Use of uninitialized value $팣칵ぇ::ʎ in print at - line 8.
246########
247# gv.c
248use utf8;
249use open qw( :utf8 :std );
250use warnings;
251package 팣칵ぇ;
252$ㄒ = 1;
253if ($ㄒ) {
254 $ㄒ++;
255 print $ʎ;
256}
257EXPECT
258Name "팣칵ぇ::ʎ" used only once: possible typo at - line 9.
259Use of uninitialized value $팣칵ぇ::ʎ in print at - line 9.
260########
261# gv.c
262use utf8;
263use open qw( :utf8 :std );
264use warnings;
265package 팣칵ぇ;
266$ㄒ = 0;
267if ($ㄒ) {
268 print "1\n";
269} elsif (!$ㄒ) {
270 print $ʎ;
271} else {
272 print "0\n";
273}
274EXPECT
275Name "팣칵ぇ::ʎ" used only once: possible typo at - line 10.
276Use of uninitialized value $팣칵ぇ::ʎ in print at - line 10.
277########
278# gv.c
279use utf8;
280use open qw( :utf8 :std );
281use warnings;
282package 팣칵ぇ;
283$ㄒ = 0;
284if ($ㄒ) {
285 print "1\n";
286} elsif (!$ㄒ) {
287 $ㄒ++;
288 print $ʎ;
289} else {
290 print "0\n";
291}
292EXPECT
293Name "팣칵ぇ::ʎ" used only once: possible typo at - line 11.
294Use of uninitialized value $팣칵ぇ::ʎ in print at - line 11.