in reply to perl -c and BEGIN block
It's impossible to check syntax without executing BEGIN blocks. The code in in BEGIN blocks including used modules can affect the parsing of subsequent code.
e.g. Does
$x = func + 2;
mean
$x = func() + 2;
or
$x = func(2);
or is it a syntax error such as
Not enough arguments
It could be any of the three. There's no way to know which without loading the module and calling it's import function from a BEGIN block.
Update: Added substantiation in the form of an example.
|
|---|