<br><br><div class="gmail_quote">On Fri, Mar 14, 2008 at 6:39 AM, He Guangsheng-W16844 <<a href="mailto:Guangsheng.He@motorola.com">Guangsheng.He@motorola.com</a>> wrote:<br><div> </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'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> package Constants;<br> <br> BEGIN {<br> require Fcntl;<br> require Socket;<br> <br> Fcntl->export_to_level( 1, '', qw(:flock) );<br>
Socket->export_to_level( 1, '', qw(:DEFAULT :crlf) );<br> }<br> <br> 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 <<a href="mailto:brian.d.foy@gmail.com">brian.d.foy@gmail.com</a>><br><a href="http://www.pair.com/~comdog/">http://www.pair.com/~comdog/</a>