<?xml version="1.0" encoding="windows-1252"?>
<node id="393966" title="Re: Including files" created="2004-09-26 12:16:10" updated="2005-07-07 14:50:53">
<type id="11">
note</type>
<author id="114691">
Aristotle</author>
<data>
<field name="doctext">
&lt;p&gt;You probably want to fix this:&lt;/p&gt;

&lt;blockquote&gt;&lt;code&gt;
my $code = join(
    "\n",
    qq[#line 1 "$filename"],
    File::Slurp::read_file($filename)
);
&lt;/code&gt;&lt;/blockquote&gt;

&lt;p&gt;You provide list context to &lt;tt&gt;read_file&lt;/tt&gt;, only to then glue all the lines back together anyway. Except that you didn't [perlfunc:chomp|chomp] them, so joining with &lt;tt&gt;\n&lt;/tt&gt; doubles all EOLs which throws off your line numbers. You want a simple concatenation instead.&lt;/p&gt;

&lt;code&gt;
my $code = qq[#line 1 "$filename"\n] . File::Slurp::read_file($filename);
&lt;/code&gt;

&lt;p&gt;Very nice work on the node.&lt;/p&gt;

&lt;div class="pmsig pmsig-114691"&gt;
&lt;p align="right"&gt;&lt;em&gt;Makeshifts last the longest.&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;</field>
<field name="root_node">
393426</field>
<field name="parent_node">
393426</field>
</data>
</node>
