Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ASP

View contents of loaded global.asa

 

 

ModPerl asp RSS feed   Index | Next | Previous | View Threaded


nick at hellaweb

Jul 13, 2004, 3:09 PM

Post #1 of 8 (3059 views)
Permalink
View contents of loaded global.asa

Does anyone know how I can view the contents of the global.asa loaded durring
runtime. I am having troubles getting non built-in subroutines to work. For
instance, I know Script_OnStart is being compiled and loaded but it seems to be
ignoring any custom sub routines I create. Here is a snip from my global.asa

sub Script_OnStart {
## Crack-open a new database handle, and if it fails,
## we should run in terror.

$dbh = CommonModules::Clinsights::db_clindex();
$dbh->{LongReadLen} = 150000;

}

sub Script_OnEnd {
## Close the database handle
if ($dbh) {
$dbh = undef;
}
}

sub check_db_connection {
if (!$dbh) {
$Response->Debug("Database Connection FAILURE!!! : " . $DBI::errstr);
$Response->Redirect("/error_page.html");
return;
}
}

When I reference check_db_connection () from one of my asp files I get an
undefined sub routine error.

Regards,

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


warren at etr-usa

Jul 15, 2004, 11:54 AM

Post #2 of 8 (2941 views)
Permalink
Re: View contents of loaded global.asa [In reply to]

Nicholas Schuetz wrote:
> Does anyone know how I can view the contents of the global.asa loaded durring
> runtime.

That would be chasing the symptom, not the cause.

Instead, convince yourself directly that the global.asa you think is
running is in fact being compiled. Add something like this to
Script_OnStart:

print STDERR "Oooga booga\n";

> When I reference check_db_connection () from one of my asp files I get an
> undefined sub routine error.

You could say this instead of the above for more info:

print STDERR "Oooga booga ", ref &\check_db_connection, "\n";

It should say "Oooga booga CODE".

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


nick at hellaweb

Jul 17, 2004, 8:50 AM

Post #3 of 8 (2923 views)
Permalink
RE: View contents of loaded global.asa [In reply to]

Thanks for the reply, Warren. I have already taken this aproach. I know the
global.asa I am working with is in fact the one being compiled. One very
important point I need to bring up is that I have UniquePackages 1 set. If I
unset this my app works fine. This exact configuration use to work in v2.19
Apache::ASP. I am now using the latest stable version 2.57. Even when
UniquePackages 1 is set.

I have tried explicitly naming the GlobalPackage to Apache::ASP::TYPHOON.
When I try to use Apache::ASP::TYPHOON it says it can not find this package.
Therefore I can't use my custom subroutine(s). Shouldn't this package be
compiling during runtime? Shouldn't it be appending that packages PATH to
@INC? Should I be putting my UniquePackaged sub routines in a file other
than the VirtualHost specific Global/global.asa PATH/file?

Quoting Warren Young <warren [at] etr-usa>:

> Nicholas Schuetz wrote:
> > Does anyone know how I can view the contents of the global.asa
> > loaded
> durring
> > runtime.
>
> That would be chasing the symptom, not the cause.
>
> Instead, convince yourself directly that the global.asa you think is
> running is in fact being compiled. Add something like this to
> Script_OnStart:
>
> print STDERR "Oooga booga\n";
>
> > When I reference check_db_connection () from one of my asp files I
> > get an undefined sub routine error.
>
> You could say this instead of the above for more info:
>
> print STDERR "Oooga booga ", ref &\check_db_connection, "\n";
>
> It should say "Oooga booga CODE".
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe [at] perl For additional
> commands, e-mail: asp-help [at] perl
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


nick at hellaweb

Jul 19, 2004, 7:39 AM

Post #4 of 8 (2911 views)
Permalink
RE: View contents of loaded global.asa [In reply to]

OK I finally figured it out. All I needed to do is specify:

package Apache::ASP::TYPHOON;

in all source files I want to use my custom subroutines in global.asa.

Thanks,

Nick


Quoting Nicholas Schuetz <nick [at] hellaweb>:

>
> Thanks for the reply, Warren. I have already taken this aproach. I know the
> global.asa I am working with is in fact the one being compiled. One very
> important point I need to bring up is that I have UniquePackages 1 set. If I
> unset this my app works fine. This exact configuration use to work in v2.19
> Apache::ASP. I am now using the latest stable version 2.57. Even when
> UniquePackages 1 is set.
>
> I have tried explicitly naming the GlobalPackage to Apache::ASP::TYPHOON.
> When I try to use Apache::ASP::TYPHOON it says it can not find this package.
> Therefore I can't use my custom subroutine(s). Shouldn't this package be
> compiling during runtime? Shouldn't it be appending that packages PATH to
> @INC? Should I be putting my UniquePackaged sub routines in a file other
> than the VirtualHost specific Global/global.asa PATH/file?
>
> Quoting Warren Young <warren [at] etr-usa>:
>
> > Nicholas Schuetz wrote:
> > > Does anyone know how I can view the contents of the global.asa
> > > loaded
> > durring
> > > runtime.
> >
> > That would be chasing the symptom, not the cause.
> >
> > Instead, convince yourself directly that the global.asa you think is
> > running is in fact being compiled. Add something like this to
> > Script_OnStart:
> >
> > print STDERR "Oooga booga\n";
> >
> > > When I reference check_db_connection () from one of my asp files I
> > > get an undefined sub routine error.
> >
> > You could say this instead of the above for more info:
> >
> > print STDERR "Oooga booga ", ref &\check_db_connection, "\n";
> >
> > It should say "Oooga booga CODE".
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: asp-unsubscribe [at] perl For additional
> > commands, e-mail: asp-help [at] perl
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe [at] perl
> For additional commands, e-mail: asp-help [at] perl
>
>



----- End forwarded message -----



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


nick at hellaweb

Jul 19, 2004, 5:30 PM

Post #5 of 8 (2919 views)
Permalink
RE: View contents of loaded global.asa [In reply to]

OK one more thing, I was reading through the Apache::ASP documentation
trying to figure out where I went a stray and here is where I think I got
confused. This is the description for GlobalPackages:

GlobalPackage

Perl package namespace that all scripts, includes, & global.asa events are
compiled into. By default, GlobalPackage is some obscure name that is
uniquely generated from the file path of the Global directory, and
global.asa file. The use of explicitly naming the GlobalPackage is to allow
scripts access to globals and subs defined in a perl module that is included
with commands like:

in perl script: use Some::Package;
in apache conf: PerlModule Some::Package

PerlSetVar GlobalPackage Some::Package

I think the line that reads, "in perl script: use Some::Package;" should be:

in perl script: package Some::Package;

Also, I never had to set the PerlModule Apache::ASP::TYPHOON directive in my
apache conf. I just set the GlobalPackage to Apache::ASP::TYPHOON, defined
my subroutines in global.asa (the global.asa was also in my Global path) and
set the package Apache::ASP::TYPHOON; line in my scripts.

Am I doing this all wrong or does this list agree that the documentation is
misleading or incorrect?

--Nick

-----Original Message-----
From: Nicholas Schuetz [mailto:nick [at] hellaweb]
Sent: Monday, July 19, 2004 9:39 AM
To: asp [at] perl
Subject: RE: View contents of loaded global.asa


OK I finally figured it out. All I needed to do is specify:

package Apache::ASP::TYPHOON;

in all source files I want to use my custom subroutines in global.asa.

Thanks,

Nick


Quoting Nicholas Schuetz <nick [at] hellaweb>:

>
> Thanks for the reply, Warren. I have already taken this aproach. I know
the
> global.asa I am working with is in fact the one being compiled. One very
> important point I need to bring up is that I have UniquePackages 1 set. If
I
> unset this my app works fine. This exact configuration use to work in
v2.19
> Apache::ASP. I am now using the latest stable version 2.57. Even when
> UniquePackages 1 is set.
>
> I have tried explicitly naming the GlobalPackage to Apache::ASP::TYPHOON.
> When I try to use Apache::ASP::TYPHOON it says it can not find this
package.
> Therefore I can't use my custom subroutine(s). Shouldn't this package be
> compiling during runtime? Shouldn't it be appending that packages PATH to
> @INC? Should I be putting my UniquePackaged sub routines in a file other
> than the VirtualHost specific Global/global.asa PATH/file?
>
> Quoting Warren Young <warren [at] etr-usa>:
>
> > Nicholas Schuetz wrote:
> > > Does anyone know how I can view the contents of the global.asa
> > > loaded
> > durring
> > > runtime.
> >
> > That would be chasing the symptom, not the cause.
> >
> > Instead, convince yourself directly that the global.asa you think is
> > running is in fact being compiled. Add something like this to
> > Script_OnStart:
> >
> > print STDERR "Oooga booga\n";
> >
> > > When I reference check_db_connection () from one of my asp files I
> > > get an undefined sub routine error.
> >
> > You could say this instead of the above for more info:
> >
> > print STDERR "Oooga booga ", ref &\check_db_connection, "\n";
> >
> > It should say "Oooga booga CODE".
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: asp-unsubscribe [at] perl For additional
> > commands, e-mail: asp-help [at] perl
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe [at] perl
> For additional commands, e-mail: asp-help [at] perl
>
>



----- End forwarded message -----



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


josh at chamas

Jul 20, 2004, 3:55 AM

Post #6 of 8 (2930 views)
Permalink
RE: View contents of loaded global.asa [In reply to]

Quoting Nicholas Schuetz <nick [at] hellaweb>:
>
> OK one more thing, I was reading through the Apache::ASP documentation
> trying to figure out where I went a stray and here is where I think I got
> confused. This is the description for GlobalPackages:
> ...
> Also, I never had to set the PerlModule Apache::ASP::TYPHOON directive in my
> apache conf. I just set the GlobalPackage to Apache::ASP::TYPHOON, defined
> my subroutines in global.asa (the global.asa was also in my Global path) and
> set the package Apache::ASP::TYPHOON; line in my scripts.
>
> Am I doing this all wrong or does this list agree that the documentation is
> misleading or incorrect?
>

Hi Nick,

I think you have it right that the documentation needs some revising. What you
do *not* need to do is set "package Apache::ASP::TYPHOON" in your scripts,
since this happens automatically when GlobalPackage is used.

Also, don't ever use the Apache::ASP::* namespace itself. Better in your case
to just use the name TYPHOON for the module name.

But let's look at the motivation for naming the GlobalPackage namespace for your
Apache::ASP application. Perhaps you want to reference a subroutine defined in
your global.asa from another module like &TYPHOON::sub(), or perhaps you want
to have an actual TYPHOON.pm module that you can load via "use TYPHOON;" whose
subroutines you can then access directly from your scripts.

It is possible that in your case that you do not even need to use the
GlobalPackage setting, and you might try running your application without it.

Regards,

Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


josh at chamas

Jul 20, 2004, 6:02 AM

Post #7 of 8 (2933 views)
Permalink
RE: View contents of loaded global.asa [In reply to]

Quoting Nicholas Schuetz <nick [at] hellaweb>:

>
> Thanks for the reply, Warren. I have already taken this aproach. I know the
> global.asa I am working with is in fact the one being compiled. One very
> important point I need to bring up is that I have UniquePackages 1 set. If I
> unset this my app works fine. This exact configuration use to work in v2.19
> Apache::ASP. I am now using the latest stable version 2.57. Even when
> UniquePackages 1 is set.
>

If you are using UniquePackages set to 1 then you are trying to have all the
scripts compiled into separate packages explicitly, so then to import
subroutines from another module namespace, I would recommend using Perl's
standard method for this, like:

use Module qw(routine);

see perldoc Exporter.

Also you might try having includes that act as subs, since that is what they
are, so that you can do this:

$Response->Include('check_db_connection');

or you could use XMLSubs have it a tag like:

<typhoon:check_db_connection />

that maps into the typhoon:: module namespace, the latter which you could define
in typhoon.pm with the correct XMLSubsMatch setting.

Regards,

Josh


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl


john.drago at e-commedia

Jul 20, 2004, 8:12 AM

Post #8 of 8 (2937 views)
Permalink
RE: View contents of loaded global.asa [In reply to]

Some clarification on Perl's "use" semantics may be necessary.

"use SomeModule;" expects to find "SomeModule.pm" on your disc in your @INC.
If it can't find it, then you have a problem.

You may want to re-read perlmod
http://www.perldoc.com/perl5.8.4/pod/perlmod.html and take another look at
perlfunc, especially "use"
http://www.perldoc.com/perl5.8.4/pod/func/use.html

GlobalPackage just makes your ASP pages all part of the same package, which
you specify.

-- John Drago






-----Original Message-----
From: Nicholas Schuetz [mailto:nick [at] hellaweb]
Sent: Monday, July 19, 2004 6:31 PM
To: asp [at] perl
Subject: RE: View contents of loaded global.asa


OK one more thing, I was reading through the Apache::ASP documentation
trying to figure out where I went a stray and here is where I think I got
confused. This is the description for GlobalPackages:

GlobalPackage

Perl package namespace that all scripts, includes, & global.asa events are
compiled into. By default, GlobalPackage is some obscure name that is
uniquely generated from the file path of the Global directory, and
global.asa file. The use of explicitly naming the GlobalPackage is to allow
scripts access to globals and subs defined in a perl module that is included
with commands like:

in perl script: use Some::Package;
in apache conf: PerlModule Some::Package

PerlSetVar GlobalPackage Some::Package

I think the line that reads, "in perl script: use Some::Package;" should be:

in perl script: package Some::Package;

Also, I never had to set the PerlModule Apache::ASP::TYPHOON directive in my
apache conf. I just set the GlobalPackage to Apache::ASP::TYPHOON, defined
my subroutines in global.asa (the global.asa was also in my Global path) and
set the package Apache::ASP::TYPHOON; line in my scripts.

Am I doing this all wrong or does this list agree that the documentation is
misleading or incorrect?

--Nick

-----Original Message-----
From: Nicholas Schuetz [mailto:nick [at] hellaweb]
Sent: Monday, July 19, 2004 9:39 AM
To: asp [at] perl
Subject: RE: View contents of loaded global.asa


OK I finally figured it out. All I needed to do is specify:

package Apache::ASP::TYPHOON;

in all source files I want to use my custom subroutines in global.asa.

Thanks,

Nick


Quoting Nicholas Schuetz <nick [at] hellaweb>:

>
> Thanks for the reply, Warren. I have already taken this aproach. I know
the
> global.asa I am working with is in fact the one being compiled. One very
> important point I need to bring up is that I have UniquePackages 1 set. If
I
> unset this my app works fine. This exact configuration use to work in
v2.19
> Apache::ASP. I am now using the latest stable version 2.57. Even when
> UniquePackages 1 is set.
>
> I have tried explicitly naming the GlobalPackage to Apache::ASP::TYPHOON.
> When I try to use Apache::ASP::TYPHOON it says it can not find this
package.
> Therefore I can't use my custom subroutine(s). Shouldn't this package be
> compiling during runtime? Shouldn't it be appending that packages PATH to
> @INC? Should I be putting my UniquePackaged sub routines in a file other
> than the VirtualHost specific Global/global.asa PATH/file?
>
> Quoting Warren Young <warren [at] etr-usa>:
>
> > Nicholas Schuetz wrote:
> > > Does anyone know how I can view the contents of the global.asa
> > > loaded
> > durring
> > > runtime.
> >
> > That would be chasing the symptom, not the cause.
> >
> > Instead, convince yourself directly that the global.asa you think is
> > running is in fact being compiled. Add something like this to
> > Script_OnStart:
> >
> > print STDERR "Oooga booga\n";
> >
> > > When I reference check_db_connection () from one of my asp files I
> > > get an undefined sub routine error.
> >
> > You could say this instead of the above for more info:
> >
> > print STDERR "Oooga booga ", ref &\check_db_connection, "\n";
> >
> > It should say "Oooga booga CODE".
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: asp-unsubscribe [at] perl For additional
> > commands, e-mail: asp-help [at] perl
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe [at] perl
> For additional commands, e-mail: asp-help [at] perl
>
>



----- End forwarded message -----



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl



---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl




---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe [at] perl
For additional commands, e-mail: asp-help [at] perl

ModPerl asp RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.