Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Perl syntax checking without `perl -c`by LanX (Saint) |
on Dec 03, 2020 at 02:15 UTC ( [id://11124561]=note: print w/replies, xml ) | Need Help?? |
Hi Ken, > 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 *) I seem to remember that perlrun allows you to inject a BEGIN without changing the actual code, just the way you start it.
In Section
Seekers of Perl Wisdom
|
|