perl-asp mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "SubbaReddy M" <m_subbare...@hotmail.com>
Subject Re: how to access vars of global.asa from my.asp file
Date Tue, 13 Nov 2001 19:53:27 GMT
Dear Joshua,

> > How to access a scalar variable in *.asp file, which declared in
global.asa file?
> > Though it is declared as use vars($title) in global.asa, unable access
the $title variable in *.asp file.
> >
>
> # in global.asa
> my $Var = "first project";
>
> # in script
> <% print $Var; %>

           As you said,
                    I  placed the my $Var = "first project"; in global.asa
                    and tried to print from 1.asp file by using <% print
$Var;%>
          but it's giving 500: Internal Server Error page.
           So checked the my error_log file : that is
            [root@qclinux asp]# tail /var/log/httpd/error_log
>>>>>>>>>>>>>>>>>>>> error log
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.
            [Tue Nov 13 05:47:36 2001] [error] [asp] [1503] [error] Global
symbol "$Var" requires explicit package name at 1.asp line 17. <--> BEGIN
not safe after errors--compilation aborted at 1.asp line 20. <--> ,
/usr/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 2089
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

>
> # global.asa
> use vars qw( %Strings ); # declare globals
>
> %Strings = (
> 'error' => 'This is an error',
> 'greeting' => 'This is a greeting.'
> );
>
> # then in ASP script
> <%= $Strings{'error'} %>

             So, I tried for global declaration, as you suggested
              but it also raising the same error: 500: Internal Server Error

>>>>>>>>>>>>>> error log >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[root@qclinux asp]#tail /var/log/httpd/error_log

[Tue Nov 13 06:08:23 2001] [error] [asp] [1570] [error] Global symbol
"%Strings" requires explicit package name at 1.asp line 19. <--> BEGIN not
safe after errors--compilation aborted at 1.asp line 22. <--> ,
/usr/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 2089
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



>
> Scripts are compiled into the same package as the global.asa, which is why
> you can share variables in this way.
>
> > So, I tried to put in $Application{'title'} = "This is my 1st
Apache::ASP project"; in global.asa
> > and tried to print in *.asp file.
>
> This should have been an error.  Remember to configure "PerlSetVar
UseStrict 1",

    Yes, it has given error on trying access the $Application{'title'} in
1.asp file.
    because of I have "PerlSetVar UseStrict 1" in httpd.conf
    and $Application{title} = "some thing"; is placed in sub Script_OnStart
(global.asa)
    and tried to print in 1.asp
    <%=$Application->{title}%>
and
    <% print $Application->{title}%>

But, it is printing blank and not raising any error.


Please, how to get it done?
I want $Var as global and $Application->{title} on Script_OnStart .

I will be waiting for your reply.

Thank you,

-SubbaReddy


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


Mime
View raw message