<br><br><div class="gmail_quote">On Fri, Mar 14, 2008 at 6:39 AM, He Guangsheng-W16844 &lt;<a href="mailto:Guangsheng.He@motorola.com">Guangsheng.He@motorola.com</a>&gt; wrote:<br><div>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

In C, we can make one header include a lot of headers, the only need to<br>
maintain changes for this one. Is that similar approach in Perl?<a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank"></a></blockquote><div><br>The Exporter module has a special function for this situation. By using export_to_level() instead of import(), you can tell the module to export to levels above you. Here&#39;s a small module that requires Fcntl and Socket, each of which defines constants,<br>
and then exports the constants to the caller of Constants:<br><br>&nbsp;&nbsp;&nbsp; package Constants;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; BEGIN {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; require Fcntl;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; require Socket;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Fcntl-&gt;export_to_level( 1, &#39;&#39;, qw(:flock) );<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Socket-&gt;export_to_level( 1, &#39;&#39;, qw(:DEFAULT :crlf) );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; 1;<br><br>The BEGIN is important: you need the export to happen as soon as possible so Perl knows about the constants when it compiles the rest of the code.<br>
</div></div><br><br clear="all"><br>-- <br>brian d foy &lt;<a href="mailto:brian.d.foy@gmail.com">brian.d.foy@gmail.com</a>&gt;<br><a href="http://www.pair.com/~comdog/">http://www.pair.com/~comdog/</a>