Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: config file vs. __DATA__

by MarkM (Curate)
on Apr 23, 2003 at 04:36 UTC ( #252450=note: print w/ replies, xml ) Need Help??

in reply to config file vs. __DATA__

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.

Comment on Re: config file vs. __DATA__

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://252450]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-11-25 21:49 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (691 votes), past polls