Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: eval, but syntax-check only -- like perl -c

by eduardo (Curate)
on Apr 24, 2003 at 18:05 UTC ( #252964=note: print w/replies, xml ) Need Help??

in reply to eval, but syntax-check only -- like perl -c

UPDATE: on second thought, I can't figure out how you would use B::Deparse intelligently, so don't pay much attention to my post :)

As far as I can tell, as you probably know, only perl can parse Perl. You might have a good shot at trying to use something crazy like B::Deparse (look in the USING B::Deparse AS A MODULE section), but even that's not going to successfully figure out the syntax of "all of perl."

Unless one of the considerably more knowledgable monks corrects me, and I hope they do, you are pretty much stuck with "perl -c" (though I would usually do "perl -wc" :)

  • Comment on Re: eval, but syntax-check only -- like perl -c

Replies are listed 'Best First'.
Re: Re: eval, but syntax-check only -- like perl -c
by diotalevi (Canon) on Apr 24, 2003 at 20:03 UTC

    There are intelligent ways to use B::Deparse but none of them apply to checking perl for syntactical correctness. The canonically correct way is to invoke the parser somehow whether through eval "sub { $code }" or through perl -c tempfile.txt.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://252964]
[LanX]: fun, last time I was in Britain people had problems with my name, just rarely they said "like the children TV star Rolf Harris?", this time most replied instantly "Rolf? like the pedophile Rolf Harris" ?
LanX is perlophile
[ambrus]: Corion: read https://metacpan. org/pod/release/ MLEHMANN/AnyEvent- 7.13/lib/AnyEvent. pm#SUPPLYING-YOUR- OWN-EVENT-MODEL- INTERFACE in that case

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2016-12-08 12:03 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (141 votes). Check out past polls.