Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Plack::App::FakeApache::Request & Mason

by cLive ;-) (Parson)
on Apr 24, 2013 at 15:55 UTC ( #1030455=perlquestion: print w/ replies, xml ) Need Help??
cLive ;-) has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to wrap a legacy mod_perl mason app in Plack. I started off easily enough, using Plack::App::FakeApache::Request and looking at request methods not in that module that needed adding, but now I'm hitting a slight roadbloak.

I don't want to have to edit any standard modules if I can avoid it, but the change I would need to make isn't easily overloaded.

The BEGIN block of HTML::Mason::ApacheHandler checks whether the request object ISA Apache2::RequestRec object or not. It's actually a Plack::App::FakeApache::Request so the Mason handler dies with the message:

The 'apache_req' parameter ("Plack::App::FakeApache::Request=HASH(0xa2ffd60)") to HTML::Mason::Request::ApacheHandler->new() was not a 'Apache2::RequestRec' (it is a Plack::App::FakeApache::Request=HASH(0xa2ffd60))

I was thinking of reblessing it before it hits Mason, but I can see that coming back to bite me.

Is there a better way to approach this? Should I give up on the Fake Request and just re-implement the Mason direct through Plack, using HTML::Mason::PlackHandler (say), and that the app rewrite will be less work than trying to get the existing app wrapped in the fake Apache handler?

Edit: After a bit more digging, I think I found a solution. Looks like the module I needed to look at was Plack::Request and to then tweak the Mason code, rather than trying to fake everything through the Apache handler.

Comment on Plack::App::FakeApache::Request & Mason

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1030455]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2014-10-26 00:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls