book/Act

Port to PSGI/Plack

perigrin opened this issue · 10 comments

Getting ACT into Github was a wonderful first step to opening up hacking. Getting ACT running on PSGI/Plack will be an excellent second setup. It will mean people don't have to set up mod_perl for doing development, something which even back in the day wasn't exact a trivial first step.

mst once proposed to do that (and make someone work on that), and said that it should be a good example for Plack/PSGI's Apache handler or HTTP::Engine's mod_perl adaptor. And also that it should require few to none change in Act source.
Never got any return on this, either positive ("the emulation thingy are worky") or negative. Don't know if that's because they didn't get the time to take a look or they just forgot to tell me. Guess I'll have to look into this myself :)

actually I think someone is working on this now for YAPC::NA 2012

(wrong button)

hoelzro and I are working on this.

How much effort/time will this be? I'm asking to gauge whether adding an issue about installation documentation would be worth it.

@wchristian: in any case, porting to PSGI is needed. Act is (more or less) tied to mod_perl 1, which is long dead. It needs to be brought into modern web age.

We now have a partly working port to Plack: https://github.com/hoelzro/Act/tree/psgi

The basic functionality of the site seems to be working, including registration and login. There are still a lot of rough edges to clean up, and certainly a number of bugs we've introduced.

The basic design is:
Act::Dispatcher is a Plack app that dispatches to the handlers.
Act::Handler::* are all Plack apps (subclassing Act::Handler) that get mounted at the appropriate URLs.
Act::Handler adapts the PSGI conventions to the existing Act conventions such as %Request and $Config.
Act::Request subclasses Plack::Request and has additional methods to be more compatible with the Apache API.
Act::Middleware::Auth replaces the Apache::AuthCookie code.

The new auth code I wrote has some pretty ugly bits in it which I'll hopefully be able to fix soon, and we are working on getting the tests fixed.

Hopefully over time more of the code can be adapted to reduce the need for the backward compatibility hacks.

Comments welcome.

book commented

Great work! I'm going to copy over your commits to a psgi branch over the main repo.

Given I have been republishing some other commits, our branches will look like they have diverged when they really haven't. Just get the master and psgi refs from the main repo again, and we should be in sync. Sorry for the inconvenience.

We were initially working out of hoelzro's repo and listing psgi specific issues on it. It would probably work better to put that on the main repo, as long as we can have rights to commit and categorize issues.

Agreed. I've been recording issues on my own copy, but I think I'll move the PSGI-specific ones here later today, and keep my fork for changes/issues specific to YAPC::NA 2012, such as Facebook login. However, you're more than welcome to cherry pick any changes you like. =)