Loading ...
Sorry, an error occurred while loading the content.

RE: View contents of loaded global.asa

Expand Messages
  • Nicholas Schuetz
    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
    Message 1 of 8 , Jul 19, 2004
    • 0 Attachment
      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@...>:

      >
      > 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@...>:
      >
      > > 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@... For additional
      > > commands, e-mail: asp-help@...
      > >
      > >
      >
      >
      >
      >
      > ---------------------------------------------------------------------
      > To unsubscribe, e-mail: asp-unsubscribe@...
      > For additional commands, e-mail: asp-help@...
      >
      >



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



      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Nicholas Schuetz
      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
      Message 2 of 8 , Jul 19, 2004
      • 0 Attachment
        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@...]
        Sent: Monday, July 19, 2004 9:39 AM
        To: asp@...
        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@...>:

        >
        > 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@...>:
        >
        > > 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@... For additional
        > > commands, e-mail: asp-help@...
        > >
        > >
        >
        >
        >
        >
        > ---------------------------------------------------------------------
        > To unsubscribe, e-mail: asp-unsubscribe@...
        > For additional commands, e-mail: asp-help@...
        >
        >



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



        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...



        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Joshua Chamas
        ... 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
        Message 3 of 8 , Jul 20, 2004
        • 0 Attachment
          Quoting Nicholas Schuetz <nick@...>:
          >
          > 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@...
          For additional commands, e-mail: asp-help@...
        • Joshua Chamas
          ... 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
          Message 4 of 8 , Jul 20, 2004
          • 0 Attachment
            Quoting Nicholas Schuetz <nick@...>:

            >
            > 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@...
            For additional commands, e-mail: asp-help@...
          • John Drago
            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
            Message 5 of 8 , Jul 20, 2004
            • 0 Attachment
              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@...]
              Sent: Monday, July 19, 2004 6:31 PM
              To: asp@...
              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@...]
              Sent: Monday, July 19, 2004 9:39 AM
              To: asp@...
              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@...>:

              >
              > 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@...>:
              >
              > > 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@... For additional
              > > commands, e-mail: asp-help@...
              > >
              > >
              >
              >
              >
              >
              > ---------------------------------------------------------------------
              > To unsubscribe, e-mail: asp-unsubscribe@...
              > For additional commands, e-mail: asp-help@...
              >
              >



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



              ---------------------------------------------------------------------
              To unsubscribe, e-mail: asp-unsubscribe@...
              For additional commands, e-mail: asp-help@...



              ---------------------------------------------------------------------
              To unsubscribe, e-mail: asp-unsubscribe@...
              For additional commands, e-mail: asp-help@...




              ---------------------------------------------------------------------
              To unsubscribe, e-mail: asp-unsubscribe@...
              For additional commands, e-mail: asp-help@...
            Your message has been successfully submitted and would be delivered to recipients shortly.