Re: same module with different pragmas

2002-09-23 Thread Rick Myers

On Sep 23, 2002 at 17:05:07 -0400, Perrin Harkins wrote:
> [EMAIL PROTECTED] wrote:
> > In the sets of applications that runs under mod_perl on our webserver
> > we need the same modules twice, but with different pragmas.
> > 
> > app1:  use module qw(standard pragma1);
> > app2:  use module qw(standard pragma2);
> > 
> > now, of course - whichever application is needed first it loads the
> > module with the mentioned pragma. Later - when the second app wants to
> > load the module, mod_perl uses the already module with the "wrong"
> > pragma.
> 
> The problem is that CGI.pm is a bunch of nasty old code that uses global 
> variables like they were going out of style (which they are).  The 
> simplest solution might be to stop using CGI.pm and switch to something 
> faster and cleaner.  However, failing that you may have to hack the 
> CGI.pm code a little to make a way to turn the XHTML header on and off. 

$CGI::XHTML = 1;  # turn it on
$CGI::XHTML = 0;  # turn it off

>   (Although, can't you just use -no_xhtml all the time?)
> 
> > Is there any trick around this problem or do I need to copy the module
> > and alter its name ?
> 
> That won't help.  It's about the module namespace, not the file name.
> 
> - Perrin
> 

--rick




RE: same module with different pragmas

2002-09-23 Thread Andrew G. Hammond

undef the module's namespace from main:: when you're done using it.  this
should cause it to be reloaded every time.

-Original Message-
From: Perrin Harkins [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 5:05 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: same module with different pragmas


[EMAIL PROTECTED] wrote:
> In the sets of applications that runs under mod_perl on our webserver
> we need the same modules twice, but with different pragmas.
>
> app1:  use module qw(standard pragma1);
> app2:  use module qw(standard pragma2);
>
> now, of course - whichever application is needed first it loads the
> module with the mentioned pragma. Later - when the second app wants to
> load the module, mod_perl uses the already module with the "wrong"
> pragma.

The problem is that CGI.pm is a bunch of nasty old code that uses global
variables like they were going out of style (which they are).  The
simplest solution might be to stop using CGI.pm and switch to something
faster and cleaner.  However, failing that you may have to hack the
CGI.pm code a little to make a way to turn the XHTML header on and off.
  (Although, can't you just use -no_xhtml all the time?)

> Is there any trick around this problem or do I need to copy the module
> and alter its name ?

That won't help.  It's about the module namespace, not the file name.

- Perrin






Re: same module with different pragmas

2002-09-23 Thread Perrin Harkins

[EMAIL PROTECTED] wrote:
> In the sets of applications that runs under mod_perl on our webserver
> we need the same modules twice, but with different pragmas.
> 
> app1:  use module qw(standard pragma1);
> app2:  use module qw(standard pragma2);
> 
> now, of course - whichever application is needed first it loads the
> module with the mentioned pragma. Later - when the second app wants to
> load the module, mod_perl uses the already module with the "wrong"
> pragma.

The problem is that CGI.pm is a bunch of nasty old code that uses global 
variables like they were going out of style (which they are).  The 
simplest solution might be to stop using CGI.pm and switch to something 
faster and cleaner.  However, failing that you may have to hack the 
CGI.pm code a little to make a way to turn the XHTML header on and off. 
  (Although, can't you just use -no_xhtml all the time?)

> Is there any trick around this problem or do I need to copy the module
> and alter its name ?

That won't help.  It's about the module namespace, not the file name.

- Perrin