Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: Testing if Perl Code is Valid - but don't execute!

by merlyn (Sage)
on Aug 13, 2010 at 02:27 UTC ( #854812=note: print w/replies, xml ) Need Help??


in reply to Re^3: Testing if Perl Code is Valid - but don't execute!
in thread Testing if Perl Code is Valid - but don't execute!

No, I would argue that you have to finish parsing the file. Which puts it at a 50% success rate. Unless you have knowledge ahead of time of all possible environments that could succeed or fail in the remaining code.

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

  • Comment on Re^4: Testing if Perl Code is Valid - but don't execute!

Replies are listed 'Best First'.
Re^5: Testing if Perl Code is Valid - but don't execute!
by JavaFan (Canon) on Aug 13, 2010 at 08:01 UTC
    Well, duh, you got to finish parsing the file to know whether it's valid or not.

    For the example given though, you don't to execute more than the BEGIN block. That is, afterall, exactly what perl -c does. It executes the BEGIN, parses the file, and then, 100% of the time, tells you whether the file contains a valid Perl program or not.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://854812]
help
Chatterbox?
[james28909]: /msg [beech] that was it. i reset everything to default and it fixed it. now to figure out exactly what was causing it!
[james28909]: good lord :(
[Lady_Aleena]: james28909, bare name...
[james28909]: /msg username message did it
[LanX]: James not /msg [beech] but /msg beech
[james28909]: i havent used the /msg [username] message</c> format
[LanX]: you can also click on beech and message him. ..
[james28909]: jebus

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-05-24 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?