1 Check strict vars functionality
5 # no strict, should build & run ok.
14 use strict qw(subs refs) ;
27 # strict vars - no error
29 use vars qw( $freddy) ;
43 Global symbol "$fred" requires explicit package name at - line 4.
44 Execution of - aborted due to compilation errors.
51 Global symbol "$fred" requires explicit package name at - line 4.
52 Execution of - aborted due to compilation errors.
59 Global symbol "$fred" requires explicit package name at - line 4.
60 Execution of - aborted due to compilation errors.
63 # Check compile time scope of strict vars pragma
71 Variable "$joe" is not imported at - line 8.
72 Global symbol "$joe" requires explicit package name at - line 8.
73 Execution of - aborted due to compilation errors.
76 # Check compile time scope of strict vars pragma
84 Global symbol "$joe" requires explicit package name at - line 6.
85 Execution of - aborted due to compilation errors.
116 Variable "$joe" is not imported at ./abc line 2.
117 Global symbol "$joe" requires explicit package name at ./abc line 2.
118 Compilation failed in require at - line 2.
129 Variable "$joe" is not imported at abc.pm line 2.
130 Global symbol "$joe" requires explicit package name at abc.pm line 2.
131 Compilation failed in require at - line 2.
132 BEGIN failed--compilation aborted at - line 2.
135 # Check scope of pragma with eval
146 # Check scope of pragma with eval
155 Global symbol "$joe" requires explicit package name at - line 6.
156 Execution of - aborted due to compilation errors.
159 # Check scope of pragma with eval
167 Global symbol "$joe" requires explicit package name at - line 5.
168 Global symbol "$joe" requires explicit package name at - line 8.
169 Execution of - aborted due to compilation errors.
172 # Check scope of pragma with eval
181 Variable "$joe" is not imported at - line 9.
182 Global symbol "$joe" requires explicit package name at - line 9.
183 Execution of - aborted due to compilation errors.
186 # Check scope of pragma with eval
196 # Check scope of pragma with eval
203 Global symbol "$joe" requires explicit package name at (eval 1) line 3.
206 # Check scope of pragma with eval
212 Global symbol "$joe" requires explicit package name at (eval 1) line 2.
215 # Check scope of pragma with eval
223 Global symbol "$joe" requires explicit package name at - line 8.
224 Execution of - aborted due to compilation errors.
227 # Check if multiple evals produce same errors
229 my $ret = eval q{ print $x; };
231 print "ok 1\n" unless defined $ret;
232 $ret = eval q{ print $x; };
234 print "ok 2\n" unless defined $ret;
236 Global symbol "$x" requires explicit package name at (eval 1) line 1.
238 Global symbol "$x" requires explicit package name at (eval 2) line 1.
242 # strict vars with outer our - no error
254 # strict vars with inner our - no error
264 # strict vars with outer our, inner use - no error
274 # strict vars with nested our - no error
286 # strict vars with elapsed our - error
294 Variable "$fred" is not imported at - line 8.
295 Global symbol "$fred" requires explicit package name at - line 8.
296 Execution of - aborted due to compilation errors.
299 # nested our with local - no error
306 print our $fred,"\n";
312 # "nailed" our declaration visibility across package boundaries
322 # multiple our declarations in same scope, different packages, no warning
334 # multiple our declarations in same scope, same package, warning
341 "our" variable $foo masks earlier declaration in same scope at - line 7.