Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

This is more of a "rubber duck" debug than anything, but I've reached a point where I think I need an external set of eyes.

I'm tasked with migrating a mod_perl app to mod_perl 2. For the last couple of weeks, it's been reasonable (run code, get error, convert code call, check it works, move on...). But now I've hit a wall and I'm not sure how to proceed.

The app uses chained PerlResponseHandlers (was PerlHander in mp1) to process plain CGI scripts and thern to wrap them in a presentation layer (this is a really old school framework, and I'm not meant to be improving it, just get it to work).

The apache config for the section I'm on is like this:

<Directory /path/to/mp> SetHandler perl-script PerlAccessHandler APP::Phase::Authen PerlResponseHandler APP::Page ModPerl::Registry Options ExecCGI </Directory>

The APP::Page module inherits from Apache::Forward, a local module based on code "Taken from Stein & MacEachern's book" (which I don't have a copy of with me, alas :) Here's the handler code from the module:

sub handler ($$) { my ($class, $r) = @_; my $next = tied *STDOUT || return SERVER_ERROR; tie *STDOUT, $class, $r, $next or return SERVER_ERROR; $r->register_cleanup( sub { no warnings 'untie'; untie *STDOUT; }); OK; }

There's also TIEHANDLE, PRINT and forward methods in the class. Two things I notice when running this under mod_perl2:

  • The sub only receives a $r argument and no $class arg
  • The tied *STDOUT is undef

I'm not 100% sure how the chained handlers work. I assume from right to left in the Apache config. But what about the tied STDOUT? Is that meant to be being defined explicitly somewhere initially? I grepped the code base for other ties to STDOUT, and I can't see any outside of this module.

I tried just dropping in use Apache2::compat into startup.pl, but that doesn't appear to have any affect on this.

I also notice in 15.4 of the ModPerl Cookbook a section on Filtered content where PerlSetVar Filter On is added to the config. Now I'm wondering why this code doesn't use that and whether I should be migrating the code to use it? Hmmm.

The mod_perl migration guide doesn't have any info on this. I'm assuming I should be reading up on details of stacked handlers or something similar. What should I be reading to get up to speed on how this worked under mod_perl 1, and how to get it working under mod_perl 2? (and any other insights welcomed).

Update: Found this presentation, which pretty much covers what I need to know. Long story short I need to look at Apache2::Filter


In reply to [RESOLVED] Migrating mod_perl app to mod_perl 2 by cLive ;-)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-29 13:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found