One especially odd factor to consider, is that Perl handles __DATA__ by retaining an open file handle that is used when later read from. This can be quite efficient -- for a single program that contains a single __DATA__ section, the beginning of the __DATA__ section may already be in memory, and no file needs to be open()'d to start reading from it.
__DATA__ sections should rarely or never be used in Perl modules unless you absolutely know what you are doing, and even then, reconsider. If every module had a __DATA__ section, and few of them used it immediately, Perl scripts would quickly use up all available file descriptors on the system. Also, using __DATA__ sections may make the module less portable or harder to store in an alternative format such as PAR. I highly doubt __DATA__ sections work properly for compiled Perl.
Personally, I prefer to store 'data' outside the program, as it allows the data to be accessed easily from multiple sources, and not just the executing (Perl) program.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|