Why write a separate Perl script? Turn this into a module that sticks a codref in @INC to filter the BEGIN blocks into harmless normal subroutines. Acme::Incorporated shows how.
| [reply] [d/l] |
| [reply] |
I think you might have missed the point about begin blocks. In order for perl to check syntax it HAS to run the use statments, because the use statments can change perls syntax. Thinks like subs in the modules included could add behaviour to bare words, especialy subs with prototypes.
| [reply] |
I think you might have missed the point about begin blocks. In order for perl to check syntax it HAS to run the use statments, because the use statments can change perls syntax. Thinks like subs in the modules included could add behaviour to bare words, especialy subs with prototypes.
Sure. It needs to include files that contain code definitions. I get that. But why does it have to run non-defining/including code to do that? Surely there's an important difference between choosing to run a sub definition to define a function and or prototype, and choosing to run everything, including calls to unlink()!
Are you saying it's impossible to write a proper syntax checker in perl? I really hope that's not true. I just want a checker that can check the program's syntax, without doing anything else. No trying to access databases, no writing to the filesystem, just a simple check to see if the code will run.
Is that really too much to ask? :-(
| [reply] |