You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Andrew O'Brien <an...@oriel.com.au> on 2007/07/11 06:35:26 UTC

Problems with EMBPERL_OBJECT_HANDLER_CLASS on stock debian etch Embperl 2.2.0 / Apache 2.2.3

Hi all,

I'm finally migrating away from an Apache 1.3 / HTML::Embperl::Object
1.3.x environment for our largest application.

I've hit a problem with EMBPERL_OBJECT_HANDLER_CLASS though. Whenever I
use it I get the following error in the apache logs which looks like
some sort of inheritance problem:

<preamble> Can't locate object method "setup_component" via package
"Embperl::__2" at /usr/lib/perl5/Embperl/Object.pm line 407.\n

If I comment out the EMBPERL_OBJECT_HANDLER_CLASS line pages render
correctly with the normal Embperl::Object operation but, of course, I'm
missing all the methods in the request object.

I'm sure I'm doing something stupid :)

I've reduced the application to the following as a minimal test case.
Can anyone shed light on what I've missed?

I've attached the embperl logfile - happy to provide any other debug
information.

base.epl
=========
<html>
  [- $req = shift; Execute('*'); -]
</html>

index.html
==========
  [- $req = shift; -]
  <head><title>Test page</title></head>
  <body>
    <h1>[+ $req->get_greeting +]</h1>
  </body>

Content of the handler class
============================
package Oriel::Embperl2Req;
use Embperl;
use Embperl::Req;
use strict;
use base qw(Embperl::Req);
sub get_greeting { 'Hello World'; }
1;

The virtualhost config
======================

<VirtualHost *:80>
	ServerAdmin andrewo@oriel.com.au
	ServerName XXXX.oriel.com.au

	DocumentRoot /var/www/test

	ErrorLog /path/to/log
	CustomLog /path/to/log

	# Now the Emperl directives
	#
	<FilesMatch "\.html$">
		SetHandler perl-script
		PerlHandler Embperl::Object
	</FilesMatch>
	# *.epl files are page building blocks only
	<Files *.epl>
		Order deny,allow
		Deny from all
	</Files>

	EMBPERL_APPNAME		test
	# optReturnError(262144)
	EMBPERL_OPTIONS		262144
	#EMBPERL_DEBUG		0
	# dbgStd(1) + dbgMem(2) + dbgEval(4) + dbgEnv(16) +
	# dbgForm(32) + dbgInput(128) + dbgSession(262144)
	#EMBPERL_DEBUG		2097327
	# dbgParse(0x1000000) + dbgObjectSearch(0x2000000) +
	# dbgFlushLog(0x200) + dbgFlushOutput(0x100)
	EMBPERL_DEBUG		0x3000300
	EMBPERL_LOG			/tmp/embperl2.log
	# Same as old optRawInput
	EMBPERL_INPUT_ESCMODE	0
	EMBPERL_OBJECT_BASE	base.epl
	EMBPERL_OBJECT_STOPDIR	"/var/www/test"
	EMBPERL_OBJECT_HANDLER_CLASS Oriel::Embperl2Req
	EMBPERL_URIMATCH	"\.(html|epl)$"

	EMBPERL_COOKIE_PATH	/
	EMBPERL_COOKIE_EXPIRES +3M

	EMBPERL_MAIL_ERRORS_TO	"andrewo@oriel.com.au"

	<Directory /var/www/test>
		Options +ExecCGI
		AllowOverride None
	</Directory>
</VirtualHost>



-- 
Andrew O'Brien

RE: Problems with EMBPERL_OBJECT_HANDLER_CLASS on stock debian etch Embperl 2.2.0 / Apache 2.2.3

Posted by Andrew O'Brien <an...@oriel.com.au>.
Sorry for wasting everyone's time. There are some days you just
shouldn't get out of bed ...

There was no

  PerlModule Oriel::Embperl2Req

In my apache config.

I don't know why I assumed EmbperlObject would do that for me!

So the following now works:

Content of the handler class
============================
package Oriel::Embperl2Req;
use Embperl;
use strict;
use base qw(Embperl::Req);
sub get_greeting { 'Hello World'; }
1;

The virtualhost config
======================
PerlModule Oriel::Embperl2Req
<VirtualHost *:80>
	ServerAdmin andrewo@oriel.com.au
	ServerName XXXX.oriel.com.au

	DocumentRoot /var/www/test

	ErrorLog /path/to/log
	CustomLog /path/to/log

	# Now the Emperl directives
	#
	<FilesMatch "\.html$">
		SetHandler perl-script
		PerlHandler Embperl::Object
	</FilesMatch>
	# *.epl files are page building blocks only
	<Files *.epl>
		Order deny,allow
		Deny from all
	</Files>

	EMBPERL_APPNAME		test
	# optReturnError(262144)
	EMBPERL_OPTIONS		262144
	#EMBPERL_DEBUG		0
	# dbgStd(1) + dbgMem(2) + dbgEval(4) + dbgEnv(16) +
	# dbgForm(32) + dbgInput(128) + dbgSession(262144)
	#EMBPERL_DEBUG		2097327
	# dbgParse(0x1000000) + dbgObjectSearch(0x2000000) +
	# dbgFlushLog(0x200) + dbgFlushOutput(0x100)
	EMBPERL_DEBUG		0x3000300
	EMBPERL_LOG			/tmp/embperl2.log
	# Same as old optRawInput
	EMBPERL_INPUT_ESCMODE	0
	EMBPERL_OBJECT_BASE	base.epl
	EMBPERL_OBJECT_STOPDIR	"/var/www/test"
	EMBPERL_OBJECT_HANDLER_CLASS Oriel::Embperl2Req
	EMBPERL_URIMATCH	"\.(html|epl)$"

	EMBPERL_COOKIE_PATH	/
	EMBPERL_COOKIE_EXPIRES +3M

	EMBPERL_MAIL_ERRORS_TO	"andrewo@oriel.com.au"

	<Directory /var/www/test>
		Options +ExecCGI
		AllowOverride None
	</Directory>
</VirtualHost>

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