Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Syntax checking without BEGIN blocks

by eric256 (Parson)
on Apr 27, 2006 at 22:19 UTC ( [id://546137]=note: print w/replies, xml ) Need Help??


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

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
  • Comment on Re^3: Syntax checking without BEGIN blocks

Replies are listed 'Best First'.
Re^4: Syntax checking without BEGIN blocks
by Anonymous Monk on Apr 28, 2006 at 15:30 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.

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://546137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found