I'm assuming mod-perl2.0:
in apache's config file:
PerlModule MyApp::Mason
<Location /test_me>
SetHandler perl-script
PerlResponseHandler MyApp::Mason
</Location>
your package:
package MyApp::Mason;
use strict;
use warnings;
use Apache2::Request;
use HTML::Mason::ApacheHandler;
sub handler {
my ($ar) = @_;
my $r = Apache2::Request->new($ar);
# do your own stuff here as you wish. This is essentially your controller
# make sure at the end of your processing $r->uri points to the right
# Mason template that you need displayed.
# eg. $r->uri ("hello_world.mas");
return HTML::Mason::ApacheHandler->handler($r);
}
- Praveen
----- Original Message ----
From: Sane <[EMAIL PROTECTED]>
To: mason-users@lists.sourceforge.net
Sent: Friday, January 5, 2007 7:33:01 PM
Subject: [Mason] Custom mod_perl content handler that wraps around Mason
Hi, I am trying to wrap a simple mod_perl handler around a
HTML::Mason::ApacheHandler. I am trying to follow the code example on Mason
HQ http://www.masonhq.com/docs/manual/Admin.html#writing_a_wrapper here.
See Below.
If I try to access or use $m or $r inside the handler sub my error log tells
me "Can't call method "request_comp" without a package or object reference
at" - at any line I try to use $m or $r. I am assuming that you put your
code inside the handler sub, but as the "example" fails to point out is
where and how do I actually use this approach.
Can anyone who has had success with this approach please point me in the
right direction. I want to keep all data access and the conventional
controller logic out of .htm or .mas files scattered about the site
heirarchey and want to use handlers to keep as much of the app. inside
apache as possible.
Thanks
Sane
PS I'm a newbie.
package MyApp::Mason;
use strict;
use HTML::Mason::ApacheHandler;
my $ah =
HTML::Mason::ApacheHandler->new
( comp_root => '/path/to/comp/root',
data_dir => '/path/to/data/dir' );
sub handler {
my ($r) = @_;
return $ah->handle_request($r);
}
--
View this message in context:
http://www.nabble.com/Custom-mod_perl-content-handler-that-wraps-around-Mason-tf2928977.html#a8188868
Sent from the Perl Mason - Users mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users