<?xml version="1.0" encoding="windows-1252"?>
<node id="992172" title="Re: Let a module call a sub of the caller" created="2012-09-06 15:24:26" updated="2012-09-06 15:24:26">
<type id="11">
note</type>
<author id="616540">
moritz</author>
<data>
<field name="doctext">
&lt;blockquote&gt;Should call "foo" after compilation (not during BEGIN). Could the module somehow define an INIT block that calls the sub?&lt;/blockquote&gt;

&lt;p&gt;The problem with that is that modules INIT and runtime are still compile time from the perspective of the calling script.&lt;/p&gt;

&lt;p&gt;You could run it in an &lt;c&gt;END&lt;/c&gt; block, which is also after compilation, but I could imagine that that's too late for your purpose. So I don't know any solution, except via source filters (or maybe evil hijacking of DESTROY subs, depending on when exactly the routine should run).&lt;/p&gt;

&lt;p&gt;Speaking of which, what is your purpose? Maybe there's a better solution to it if we know the bigger picture.&lt;/p&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-616540"&gt;
[http://perl6.org/|Perl 6 - the future is here, just unevenly distributed]
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
992164</field>
<field name="parent_node">
992164</field>
</data>
</node>
