|Perl Monk, Perl Meditation|
Re: call a modules INIT-section (fix for Win32::API::Type)by ihb (Deacon)
|on Mar 20, 2005 at 12:45 UTC||Need Help??|
I took a glance at Win32::API::Type which is the module that uses INIT. It seems like the author has misunderstood the purpose of INIT blocks. There's no need for the code to execute at INIT time. With some hackery you can work around this. The idea goes like this: add an INC hook that if Win32::API::Type gets used it locates the file it wants to use, reads the file, removes the INIT, opens a filehandle to the modified source and returns the filehandle. Code-wise it can look like
As for locating which file to load there's a number of modules on CPAN that does that.
See perltoc if you don't know which perldoc to read!