On 2004-02-12, Cees Hek <suppressed> wrote:
>
> Hi Mark,
>
> I think the problem is actually in your test code, and not in
> CGI::Application. You are running into a multiple inheritance problem
> and your TestImport module is actually using the import function in
> CGI::Application instead of the one provided by Exporter. So the global
> never gets exported...
>
> Your @ISA looks contains ('CGI::Application', 'Exporter') since you push
> Exporter onto the existing @ISA, where Exporter really needs to be first
> for it to work correctly...
>
> Here are a few ways of solving the problem in your code:
>
> # unshift to the front of @ISA
> require Exporter;
> unshift @ISA, qw(Exporter);
>
> # bring import into your namespace
> use Exporter qw(import);
>
> # copy import into your namespace manually
> require Exporter;
> *import = \&Exporter::import;
Thanks for the help Cees.
I understand what you are saying and agree that it would be best to fix
this in my code. However, look at like at it like this: I upgraded
CGI::App and many products quit working, all of which wouldn't be easy
to track down. If this happened to me, this will happen to other
people.
The solution that makes sense to me is for CGI::App have an import
function that calls Exporter import to provide a 'standard' import
function, and then additionally adds the 'cgicarp' code to the mix.
Does that seem reasonable or does it just sound like a hack?
Mark
--
http://mark.stosberg.com/
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.