Re: INIT block in XML::Xerces

[email protected] (Jason E. Stewart) Thu, 13 Jan 2005 22:03:18 +0530
Newsgroups gmane.text.xml.xerces-p.devel
Message-ID <[email protected]>
"Colin Robertson" <[email protected]> writes:

> I'm working on a module which is intended to be loaded dynamically using
> an eval. That module then uses XML::Xerces. However, when it gets loaded
> it prints out the error message "Too late to run INIT block at
> /usr/local/cps_perl5.6.1/site_perl/sun4-solaris/XML/Xerces.pm line 17."
>
> As a workaround, I'm running XML::Xerces::XMLPlatformUtils::Initialize()
> after loading XML::Xerces, so that at least that code gets run. That's
> not very safe though, since the contents of the INIT block could change
> in the future. Also the user still sees the error message when they use
> my module.
>
> Would it be possible for XML::Xerces to call the Initialize routine in a
> way that would be friendlier to dynamic loading?

Hi Colin,

This INIT block has bothered me as well. I put it in Xerces so that
initialization would be run automagically for Perl users. I suppose, I
could put it in a BEGIN block, but I haven't tested it. If you would
like to test that idea or provide others, I will be happy to
incorporate them into the next release of Xerces.

Cheers,
jas.