<?xml version="1.0" encoding="windows-1252"?>
<node id="990269" title="How to do perl -c inside perl?" created="2012-08-28 11:43:08" updated="2012-08-28 11:43:08">
<type id="115">
perlquestion</type>
<author id="985538">
rockyb</author>
<data>
<field name="doctext">
&lt;p&gt;O great monks, I come yet again to drink from the fountain of wisdom.&lt;/p&gt; 

&lt;p&gt;Again related to this silly debugger &lt;a href="https://metacpan.org/module/Devel::Trepan"&gt;Devel::Trepan&lt;/a&gt;, I would like to run from inside this perl program &lt;tt&gt;perl -c 'code'&lt;/tt&gt; and sometimes &lt;tt&gt;perl -ce 'expression'&lt;/tt&gt; in order to check validity of various statements and expressions.&lt;/p&gt;

&lt;p&gt;This of course works using &lt;em&gt;system()&lt;/em&gt; and backtick, but I wonder if there isn't a way inside perl to run a compile check without having to reinvoke perl at the outset. After all, &lt;em&gt;eval()&lt;/em&gt; has to go through pretty much the same steps too, and it probably does not use either &lt;em&gt;system&lt;/em&gt; or backtick.&lt;/p&gt;

&lt;p&gt;Let me finally note that for my purpose using backtick is less code and cleaner to to write than &lt;em&gt;system()&lt;/em&gt; with additional code to capture output. I don't want output to be shown. However I have found that backtick sometimes isn't supported well enough on Windows, whereas &lt;em&gt;system()&lt;/em&gt; more often is.&lt;/p&gt;</field>
</data>
</node>
