Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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

by cLive ;-) (Prior)
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1030455]
Approved by marto
[s1akov]: The Perl Monks Guide to the Monastery

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2017-11-18 16:50 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (277 votes). Check out past polls.