in reply to Re: Syntax checking without BEGIN blocks
in thread Syntax checking without BEGIN blocks

Yuck. Isn't there an option to the syntax checker to just, you know, check the syntax without actually running anything? :-(

Is anyone working on this?

  • Comment on Re^2: Syntax checking without BEGIN blocks

Replies are listed 'Best First'.
Re^3: Syntax checking without BEGIN blocks
by eric256 (Parson) on Apr 27, 2006 at 22:19 UTC

    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.


    ___________
    Eric Hodges
      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? :-(

        With eval and symbol table magic modules import could could be modifing the syntax of the main program. In fact all module imports are actualy running the code in the import. I think realy you should be mad at the people who have there imports unlinking files etc not at perl ;) This is just part of the price you pay for a dynamic language.


        ___________
        Eric Hodges
        A reply falls below the community's threshold of quality. You may see it by logging in.