in reply to Perl syntax checking without `perl -c`
> like 'perl -c ...', that will just check the syntax without executing any part of the code?
the problem is that imported functions can change the syntax.
Just think of something like sub foo (&) {} , which will only compile if it finds foo {...} later. That's the main reason why Perl is so hard to parse statically.
> The use statements will be my biggest problem; although, others may crop up here and there.
> "Can't locate SomeMod.pm in @INC ..."
OK let's suppose the exported functions don't change the syntax.
What you could do is pretending that "SomeMod.pm" was already loaded, by setting %INC in a BEGIN block.* No need to find a module which was already "loaded".
But these are kind of hairy workarounds, do you really think it's worth going down that road?
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
*) I seem to remember that perlrun allows you to inject a BEGIN without changing the actual code, just the way you start it.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl syntax checking without `perl -c`
by kcott (Archbishop) on Dec 03, 2020 at 02:37 UTC | |
by LanX (Saint) on Dec 03, 2020 at 10:34 UTC | |
Re^2: Perl syntax checking without `perl -c`
by choroba (Cardinal) on Dec 03, 2020 at 10:43 UTC | |
by Fletch (Bishop) on Dec 03, 2020 at 14:58 UTC | |
by LanX (Saint) on Dec 03, 2020 at 15:15 UTC | |
by stevieb (Canon) on Dec 05, 2020 at 17:00 UTC | |
by LanX (Saint) on Dec 05, 2020 at 17:44 UTC | |
by LanX (Saint) on Dec 03, 2020 at 14:49 UTC |