in reply to Re^2: __DATA__ used in BEGIN
in thread __DATA__ used in BEGIN
For these objects , hashes were created, as a kind of exception to the rule and these were initialized at the loading the module.This is still confusing. Are you sure you need to do this in a BEGIN block? If you really need to initialize this hash "at runtime" as you say, then you can do it in normal code. (And if you can do it in normal code, I would suggest calling a sub that returns the hash, rather than using __DATA__.)...
To be short, a (huge) hash has to be initialised at run time.
Also unclear is whether this initialization is happening in a script or in a module. If it's a module and you just need the hash to be created when the module is used, then again a BEGIN block is not necessary. If, on the other hand, it's in a script and you need the hash to be created before any modules are loaded, then BEGIN is necessary.
It would help to see some actual code here.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: __DATA__ used in BEGIN
by Tabari (Monk) on Nov 12, 2007 at 17:05 UTC |