perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Wesemann <f.wesem...@fotofinder.net>
Subject virtualhosts with same Docroots steal Request object and Session
Date Fri, 05 Oct 2007 20:28:57 GMT
Dear list,
I have this scenario:
Two virtual servers ( A and B ) share the same DocumentRoot,
due to the fact that every server needs some special "global" variables,
each is set up with its own Perl interpreter.
The first Request to the page mypage.epl determinates which server has 
the "right" Enviroment.
Subsequent Request to the same document from the other server shows that 
not even the variable is "gone", but also the Embperl-Request and 
therefore udat, mdat and fdat.

To make clear what happens:
httpd.conf:
MaxServers 1
<VirtualHost  12.34.56:8080>
    Servername A
    PerlOptions    +Parent
    PerlSwitches   -Mlib=/webserver/A/lib
    PerlRequire    /webserver/A/lib/startup.pl
    Embperl_Appname A-app
    Embperl_Options 270338
    Embperl_Cookie_Name "A_cookie"
    DocumentRoot /webservers/htdocs
</VirtualHost>
<VirtualHost  12.34.56:80>
    Servername B
    PerlOptions    +Parent
    PerlSwitches   -Mlib=/webserver/B/lib
    PerlRequire    /webserver/B/lib/startup.pl
    Embperl_Appname B-app
    Embperl_Options 270338
    Embperl_Cookie_Name "B_cookie"
    DocumentRoot /webservers/htdocs
</VirtualHost>

startup.pl:
use Some::Modul;
our $GLOBAL;
$GLOBAL = { key1 => A | B };

mypage.epl:
<html><pre>
outerTEXT
[*
my $r = shift;
print OUT "TEST:\n";
print OUT Data::Dumper::Dumper( $::GLOBAL );
print OUT Data::Dumper::Dumper ( $r );
*]
<pre></html>

If I access mypage.epl through server A
http://A/mypage.epl, I got the following ( expected ) result:
outerTEXT
TEST:
$VAR1 = {
                    'key1' => A
                };

$VAR1 = bless( {}, 'Embperl::Req' );

If I call http://B/mypage.epl, I get :
outerTEXT

Not even the static "TEST" ist printed, neither the expected "key1 => B"
Attempts to set $udat{'somekey} fail because "Can't call method "init" 
on unblessed reference at 
/usr/lib/perl5/site_perl/5.8.5/Apache/SessionX.pm" and in fact is $self 
in SessionX.pm undef.
Attemps to access $r->app fail, because of  "Can't call method "app" on 
an undefined value".

If I force a recompile of the page and access it at first from server B 
everything is the other way round.

I expected each virtual host to have a global variable called $::GLOBAL 
and %udat and $r to behave "normal" because, the not only have their own 
Perlinterpreters but also different Embperl_Appnames and even the cookie 
name ist different, so that their should be IMHO no interference.

What am I missing here?
Any hint is welcome.
thanks in advance


frank

-- 
mit freundlichem Gruß,

Frank Wesemann
Fotofinder GmbH         USt-IdNr. DE812854514
Software Entwicklung    Web: http://www.fotofinder.net/
Potsdamer Str. 96       Tel: +49 30 25 79 28 90
10785 Berlin            Fax: +49 30 25 79 28 999

Sitz: Berlin
Amtsgericht Berlin Charlottenburg (HRB 73099)
Geschäftsführer: Ali Paczensky




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


Mime
View raw message