You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Dimitri Ostapenko <di...@perlnow.com> on 2002/01/11 19:33:08 UTC
EmbperlObject 2 on linux
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I just installed 2.0b5 on remote machine that I have no root access to.
it runs Apache/1.3.6 (Unix) with all required by Embperl modules compiled in
That leaves me with an option of running EmbperlObject through epocgi.pl
.htaccess:
AddType text/html .emb
<Files *.emb>
Action text/html /cgi-bin/epocgi.pl
</Files>
base.emb:
<HTML>
<HEAD>
<TITLE>Some title</TITLE>
</HEAD>
[-
$req = shift;
$req->{webmaster} = 'John Smith'
- -]
<BODY>
[- Execute ('*') -]
</BODY>
</HTML>
file t.emb I execute is just
[+ 2+2 +]
and get
4 $VAR1 = bless( { 'webmaster' => 'John Smith' }, 'HTML::Embperl::DOC::_2' );
HTTP/1.1 200 OK Date: Fri, 11 Jan 2002 18:23:44 GMT
Server: Apache/1.3.6 (Unix) PHP/4.0.3pl1 mod_gzip/1.3.19.1a mod_ssl/2.3.6
OpenSSL/0.9.3a Content-Length: 2 Keep-Alive:
timeout=10, max=99 Connection: Keep-Alive Content-Type: text/html 4 $VAR1 =
bless( { 'webmaster' => 'John Smith' },
which looks to me like header is spit out after page is processed
In 1.3.4 all works just fine with the same epocgi.pl, which I added following
2 lines to:
$req{'object_base'} = 'base.emb';
$req{'object_stopdir'} = '/home/perlnow/public_html';
Sometimes I get '>' at the end of output, but I don't have any loose '>' in
my files and couldn't find anything in EmbperlObject::Execute.
- --
Dimitri Ostapenko,
Ostapenko Consulting Inc.
perl/java/internet
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8Py/lZ9+Y+uWmwdgRAqF3AJ44wPcgIR5qbmYxZxdtERF+Bz4QvQCcC3IP
vhxQ1sPlrmTscOQtF8K+izc=
=oehC
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: EmbperlObject 2 on linux
Posted by Dimitri Ostapenko <di...@perlnow.com>.
Thanks Gerald. I understand what's happening now.
Dimitri
On Tuesday 15 January 2002 15:47, Gerald Richter wrote:
> > You can see output @ http://www.perlnow.com/t.emb:
>
> I tried
>
> GET -s -e http://www.perlnow.com/t.emb
>
> and I get:
>
> 200 OK
> Connection: close
> Date: Tue, 15 Jan 2002 20:42:18 GMT
> Server: Apache/1.3.6 (Unix) PHP/4.0.3pl1 mod_gzip/1.3.19.1a mod_ssl/2.3.6
> OpenSSL/0.9.3a
> Content-Length: 2
> Content-Type: text/html
> Client-Date: Tue, 15 Jan 2002 20:42:13 GMT
> Client-Peer: 216.218.153.116:80
> Title: Some title
>
> <HTML>
> <HEAD>
> <TITLE>Some title</TITLE>
> </HEAD>
> <BODY>
> 4
> </BODY>
> </HTML>
>
> There is now 4 before the headers and my browser shows me the correct page
> (a simple 4). Of course the Content-Length of 2 is wrong. The wrong
> Content-Length is the reason why you sometimes only see a '<'.
>
> Since Embperl 2 can't calculate the Content-Length right now, we have to
> remove the Content-Lenght header. Go to epmain.c line 3111. You should see
> a sprintf followed by a oputs, comment out both lines and it should work.
>
> If you still get the 4 before your headers, let me know
>
> Gerald
>
>
> -------------------------------------------------------------
> Gerald Richter ecos electronic communication services gmbh
> Internetconnect * Webserver/-design/-datenbanken * Consulting
>
> Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
> E-Mail: richter@ecos.de Voice: +49 6133 925131
> WWW: http://www.ecos.de Fax: +49 6133 925152
> -------------------------------------------------------------
--
Dimitri Ostapenko,
Ostapenko Consulting Inc.
perl/java/internet
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: EmbperlObject 2 on linux
Posted by Gerald Richter <ri...@ecos.de>.
> You can see output @ http://www.perlnow.com/t.emb:
I tried
GET -s -e http://www.perlnow.com/t.emb
and I get:
200 OK
Connection: close
Date: Tue, 15 Jan 2002 20:42:18 GMT
Server: Apache/1.3.6 (Unix) PHP/4.0.3pl1 mod_gzip/1.3.19.1a mod_ssl/2.3.6
OpenSSL/0.9.3a
Content-Length: 2
Content-Type: text/html
Client-Date: Tue, 15 Jan 2002 20:42:13 GMT
Client-Peer: 216.218.153.116:80
Title: Some title
<HTML>
<HEAD>
<TITLE>Some title</TITLE>
</HEAD>
<BODY>
4
</BODY>
</HTML>
There is now 4 before the headers and my browser shows me the correct page
(a simple 4). Of course the Content-Length of 2 is wrong. The wrong
Content-Length is the reason why you sometimes only see a '<'.
Since Embperl 2 can't calculate the Content-Length right now, we have to
remove the Content-Lenght header. Go to epmain.c line 3111. You should see a
sprintf followed by a oputs, comment out both lines and it should work.
If you still get the 4 before your headers, let me know
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: EmbperlObject 2 on linux
Posted by Dimitri Ostapenko <di...@perlnow.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 14 January 2002 11:55, Gerald Richter wrote:
> > 4 $VAR1 = bless( { 'webmaster' => 'John Smith' },
>
> 'HTML::Embperl::DOC::_2' );
>
> Looks like there is a Data::Dumper output that is printed to STDOUT instead
> of OUT, because the Data::Dumper output comes before the headers, the
> browser can't interpret the headers.
>
> Do you have inserted a "print Dumper" or something similar anywhere ?
>
> Gerald
>
>
Here's what I just did to test it again:
1. I reinstalled HTML-Embperl-2.0b5.tar.gz using Cpan.pm.
Install was clean. I did not use mod_perl option. I install into local perl
installation in my homedir. I use latest stable Perl 5.6.1, built from source.
2. Here's my full epocgi.pl:
#!/home/perlnow/local/bin/perl
......
# $Id: epocgi.pl.templ,v 1.2 2001/05/15 10:41:23 richter Exp $
#
###################################################################################
use HTML::Embperl ;
use HTML::EmbperlObject ;
my $Logfile = $ENV{EMBPERL_LOG} || $HTML::Embperl::DefaultLog ;
my $rc ;
my $ioType ;
my %req ;
HTML::EmbperlObject::ScanEnvironment (\%req) ;
$req{'object_base'} = 'base.emb';
$req{'object_stopdir'} = '/home/perlnow/public_html';
$req{'inputfile'} = $ENV{PATH_TRANSLATED} ;
$ioType = HTML::Embperl::epIOCGI ;
HTML::Embperl::XS_Init ($ioType, $Logfile, $DebugDefault) ;
tie *LOG, 'HTML::Embperl::Log' ;
$req{'uri'} = $ENV{SCRIPT_NAME} ;
$req{'cleanup'} = 0 ;
$req{'cleanup'} = -1 if (($req{'options'} &
HTML::Embperl::optDisableVarCleanup)) ;
$req{'options'} |= HTML::Embperl::optSendHttpHeader ;
#
###################################################################################
use HTML::Embperl ;
use HTML::EmbperlObject ;
my $Logfile = $ENV{EMBPERL_LOG} || $HTML::Embperl::DefaultLog ;
my $rc ;
my $ioType ;
my %req ;
HTML::EmbperlObject::ScanEnvironment (\%req) ;
$req{'object_base'} = 'base.emb';
$req{'object_stopdir'} = '/home/perlnow/public_html';
$req{'inputfile'} = $ENV{PATH_TRANSLATED} ;
$ioType = HTML::Embperl::epIOCGI ;
HTML::Embperl::XS_Init ($ioType, $Logfile, $DebugDefault) ;
tie *LOG, 'HTML::Embperl::Log' ;
$req{'uri'} = $ENV{SCRIPT_NAME} ;
$req{'cleanup'} = 0 ;
$req{'cleanup'} = -1 if (($req{'options'} &
HTML::Embperl::optDisableVarCleanup)) ;
$req{'options'} |= HTML::Embperl::optSendHttpHeader ;
$rc = HTML::EmbperlObject::Execute (\%req) ;
#close LOG ;
HTML::Embperl::XS_Term () ;
if ($rc)
{
$time = localtime ;
my $req = join ':', %req;
print <<EOT;
Status: $rc
Content-Type: text/html
<HTML><HEAD><TITLE>Embperl Error</TITLE></HEAD>
<BODY bgcolor=\"#FFFFFF\">
<H1>epocgi Server Error: $rc</H1>
[ $req ]<br>
Please contact the server administrator, $ENV{SERVER_ADMIN} and inform them
of the time the error occurred,
$ENV{SERVER_SOFTWARE} HTML::Embperl $HTML::Embperl::VERSION [$time]<P>
</BODY></HTML>
EOT
}
I just added 2 lines :
$req{'object_base'} = 'base.emb';
$req{'object_stopdir'} = '/home/perlnow/public_html';
3. my .htaccess in public_html dir:
DirectoryIndex index.html /cgi-bin/rightsql.CGI
Options Includes
AddType text/x-server-parsed-html .html
ErrorDocument 404 /error.htm
#DirectoryIndex index.emb index.html
AddType text/html .emb
<Files *.emb>
Action text/html /cgi-bin/epocgi.pl
</Files>
4. base.emb in public_html dir (DocRoot for my vhost)
<HTML>
<HEAD>
<TITLE>Some title</TITLE>
</HEAD>
[-
$req = shift;
$req->{webmaster} = 'John Smith'
- -]
<BODY>
[- Execute ('*') -]
</BODY>
</HTML>
5. t.emb in public_html:
[-
$req = shift;
- -]
[+ 2+2 +]
- ----------
You can see output @ http://www.perlnow.com/t.emb:
4 HTTP/1.1 200 OK Date: Mon, 14 Jan 2002 20:31:18 GMT Server: Apache/1.3.6
(Unix) PHP/4.0.3pl1 mod_gzip/1.3.19.1a mod_ssl/2.3.6
OpenSSL/0.9.3a Content-Length: 2 Keep-Alive: timeout=10, max=99 Connection:
Keep-Alive Content-Type: text/html 4
4 is printed twice for some reason: one before and one after the header.
Content-Length is also 2, though I just print 1 char
I used Data::Dumper [+ Dumper $req +] in prev version (as I often do on other
sites using EmbPerlObject) but I got rid of it now so [+ 2+2 +] is
all t.emb has.
Exact same setup works on my machine at home running
1.3.22/mod_perl/1.26/Perl 5.6.1/Embperl 1.3.22_2.0b3
And on perlnow.com under EmbPerl 1.3.4
Which leads me to think that problem is apache version specific. (they use
Apache/1.3.6 @ host for perlnow.com)
Thanks
- --
Dimitri Ostapenko,
Ostapenko Consulting Inc.
perl/java/internet
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8Q0vCZ9+Y+uWmwdgRApQ+AKCNS4a8XUVi0QzKhQY7d66eWQOOvgCfXlgz
MmpinVn/47Ck5XOLDb5TXyo=
=LEyy
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: EmbperlObject 2 on linux
Posted by Gerald Richter <ri...@ecos.de>.
>
> 4 $VAR1 = bless( { 'webmaster' => 'John Smith' },
'HTML::Embperl::DOC::_2' );
Looks like there is a Data::Dumper output that is printed to STDOUT instead
of OUT, because the Data::Dumper output comes before the headers, the
browser can't interpret the headers.
Do you have inserted a "print Dumper" or something similar anywhere ?
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org