Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^4: how to check syntax of code inside a scalar?

by snoopy (Deacon)
on Aug 04, 2010 at 21:55 UTC ( #852982=note: print w/replies, xml ) Need Help??

in reply to Re^3: how to check syntax of code inside a scalar?
in thread how to check syntax of code inside a scalar?

This does however seem to match the perl -c syntax check. From perlrun:
       -c   causes Perl to check the syntax of the program and then exit
            without executing it.  Actually, it will execute "BEGIN",
            "UNITCHECK", "CHECK", and "use" blocks, because these are
            considered as occurring outside the execution of your program.
            "INIT" and "END" blocks, however, will be skipped.
perl -c -e 'BEGIN { print "yay\n"; }; print "boo\n"'
yay -e syntax OK

Replies are listed 'Best First'.
Re^5: how to check syntax of code inside a scalar?
by aquarium (Curate) on Aug 05, 2010 at 03:39 UTC
    What if you always inject a
    BEGIN {exit}
    will it still do the compile step?
    the hardest line to type correctly is: stty erase ^H
      I't wouldn't do the compile step, but because this happens early, it would pretty well bypass any syntax checking whatsoever:
      perl -c -e 'BEGIN{exit}; BEGIN{print "yay\n"};@&$^^#@!.' -e syntax OK

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://852982]
[LanX]: shmem: ah I see ... you'll need to check if the monastery standard classes come with border ... like the nodelets should
[karlgoethebier]: shmem: you could have linked to jackass as well ;-)
[stonecolddevin]: morning all
[shmem]: karlgoethebier: better choice, done. :-)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2017-07-24 17:01 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (356 votes). Check out past polls.