Well how do you account for the behaviour that there are no errors when the syntax is correct, but an error when the syntax is wrong ( like a missing colon or scalars define twice with my)? Then if the syntax is ok, it lets it run and evaluation errors appear at runtime?
UPDATE added example
For instance this will stop at compile time:
#!/usr/bin/perl
use strict;
use warnings;
use lib '.';
use WarnMe;
print "1\n";
print $WarnMe::val,"\n";
print "2\n";
package WarnMe;
use strict;
use warnings;
# syntax error
my $val = $Some:Nonexistent::Pkg::variable;
1;
outputs:
zentara@:zentara$ ./WarnMe
Global symbol "$Some" requires explicit package name at WarnMe.pm line
+ 7.
syntax error at WarnMe.pm line 7, near "$Some:"
Compilation failed in require at ./WarnMe line 5.
BEGIN failed--compilation aborted at ./WarnMe line 5.
Clearly the Perl compiler is checking syntax first. If you fix that syntax error, the script will compile and run with issuing a non-fatal runtime error:
Name "WarnMe::val" used only once: possible typo at ./WarnMe line 8.
1
Use of uninitialized value in print at ./WarnMe line 8.
2
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.