You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Alex Titov <ad...@3in1hosting.com> on 2004/02/01 22:11:29 UTC

fdat, OUT variables scope question

Hi all,

Great project, thank you Gerald and developer team !

I have one question:
I've noticed that I can't get to any EmbPerl-specific global variable
from within the package. This is for %fdat, %http_headers_out, OUT and
others I suppose. But perl-specific global variables like %ENV works
ok. Here are the code to illustrate:

[-
        print OUT 'qs: ', $ENV{QUERY_STRING}, '<br>';
        print OUT 'aaa: ', $fdat{aaa}, '<br>';
        
        my $p = new MyTest;
        
        print OUT 'qs: ', $p->GetQueryString(), '<br>';
        print OUT 'aaa: ', $p->GetAAA(), '<br>';
        
        
        package MyTest;
        
        sub new {
                my $self = {};
                return bless $self;
        }
        
        sub GetQueryString {
                return $ENV{QUERY_STRING};
        }

        sub GetAAA {
                return $fdat{aaa};
        }
-]

I call it as 'test.epl?aaa=qwe' and have this output:
qs: aaa=qwe
aaa: qwe
qs: aaa=qwe
aaa:

Is it a normal situation or whether I do something wrong ?
Or maybe something can be done to be able to see %fdat hash array from
within the package ?

I use
httpd-2.0.48
perl-5.8.0
mod_perl-1.99-12
Embperl-2.0b10

http.conf:
LoadModule perl_module          modules/mod_perl.so
LoadModule embperl_module       modules/Embperl.so 
PerlModule Embperl

<Files "*.epl">
        SetHandler  perl-script
        Options     ExecCGI         
        PerlHandler Embperl         
</Files>
                                    
Thank you in advance,
Alex


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


Re: fdat, OUT variables scope question

Posted by Gerald Richter <ri...@ecos.de>.
Hi
>
> I have one question:
> I've noticed that I can't get to any EmbPerl-specific global variable
> from within the package. This is for %fdat, %http_headers_out, OUT and
> others I suppose. But perl-specific global variables like %ENV works
> ok.

%ENV is provided by Perl itself, to get the same behaviour for Embperl
variables it would be necessary to patch Perl itself.

Just use %Embperl::fdat etc. inside your packge. Alternativly, if you like
more the OO way, you could pass Embperl's request rec ($epreq) and write
$epreq -> component -> param -> fdat, which gives you an reference to %fdat

Gerald


--------------------------------------------------------------
Gerald Richter     ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
--------------------------------------------------------------
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-------------------------------------------------------------


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