You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Colin Robertson <Co...@bbc.co.uk> on 2005/01/13 12:49:31 UTC

INIT block in XML::Xerces

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?

colin

http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


Re: INIT block in XML::Xerces

Posted by "Jason E. Stewart" <ja...@openinformatics.com>.
"Colin Robertson" <Co...@bbc.co.uk> 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.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org