Jun. 3rd, 2008

mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
[staff profile] mark
Here's a quick and dirty guide to things you will need to watch for when touching files and how to help us convert everything to Apache 2 / mod_perl 2 compatibility.

1) The Request Object

Never call Apache->request.  If you need the request object, use BML::get_request() which will do the Right Thing to return the appropriate request object for you to mess with.

2) $ENV{LJHOME} is Dead

You should use $LJ::HOME instead.  (Caveat: if you're writing a command line tool, you may need to use the environment variable, depending on what libraries you load... but for web context, always use $LJ::HOME!)

3) Methods become Hashes

In a move that I don't particularly understand, now we must pluralize some things and treat most things like a hash.  If you are used to this:

   $r->header_in("Host")
   $r->header_in("Host" => "bar");
   $r->notes("Something")

Then you should now get used to this:

   $r->headers_in->{Host};
   $r->headers_in->{Host} = "bar";
   $r->notes->{Something}

Not much of a change.  This goes for all of the header calls: headers_in, headers_out, err_headers_in, err_headers_out, etc as well as notes and pnotes.  There are probably other changes I've missed that do this too.

4) $r->send_http_header defunct?

I've yet to figure out a replacement for this function.  It seems to not be required anymore?  The modules seem to do the right thing, at least in all of the cases I've tried, without ever calling this.

5) ...?

I'm sure I'm missing something.  But at this point, if you want to start grepping through dw-free for header_in, send_http_header, notes, etc and then start fixing it, go for it!  It's appreciated, as there are still many files that have these.

As a second/other thought, I've been debating creating an LJ::Request object that we can use instead of Apache2::RequestRec (or whatever it is).  That way, if we ever need to change the way something works (i.e. upgrade to Apache 2.2 / mod_perl 2.2?) then we can change that one module.

Opinions and discussion are welcome, of course!

Profile

dw_dev: The word "develop" using the Swirly D logo.  (Default)
Dreamwidth Open Source Development

July 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223 242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 10th, 2025 10:08 pm
Powered by Dreamwidth Studios