I said I was going to let this go...but I didn't...and boy I wish I had.

I can sum up my findings here. Consider this starting point...

package Mason::TestHandler; use strict; use warnings; use HTML::Mason::ApacheHandler; our @ISA = qw(HTML::Mason::ApacheHandler); sub handler { my($r) = @_; # Remember, $r contains a virtual filename (does not exist on disk +). my @fileList = someMagicToGetFiles($r); my $testPath = $fileList[0]; # ... VARIOUS ATTEMPTS GO HERE ... # }

Then I tried to get it to work a bunch of different ways...

... my $ah = HTML::Mason::ApacheHandler->make_ah($r); my $mi = $ah->interp; my $output = $mi->exec($testPath);

This will fail with error "[error] Mandatory parameter 'ah' missing in call to MasonX::Request::WithApacheSession->new()\n"

... $r->filename($testPath); my $ah = HTML::Mason::ApacheHandler->make_ah($r); my $output = $ah->prepare_request($r);

This will fail with error "[Mason] Cannot resolve file to component: /somepath/realfile.js (is file outside component root?) at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 852."

I then tried making the path start with the exact CompRoot listed in my config (different route to same file). That gives me the error "[error] Can't locate object method "param" via package "Apache::Filter" at /usr/lib/perl5/site_perl/5.8.8/HTML/Mason/ApacheHandler.pm line 996.\n"

I've tried different variations of the same theme, with one of these errors coming up each time. The only way I've gotten the interpreter to work is by directly creating it:

... use HTML::Mason::Interp; my $mi = HTML::Mason::Interp->new(data_dir => '/a/good/data/dir/' +, comp_root => '/a/good/comp/root/ +', ); my $c = $mi->make_component(comp_file => $testPath ); my $output = $mi->exec($c);

Because my $r is valid, I can even snarf the values I need out of it. However, one of the key goals was to have valid session information. So if I add the request_class and session_class to the above, I am still missing ah (see first attempt). This ah error comes up a lot.

Sigh. So I am completely out of ideas.


In reply to Re: Mason Interp Perl string by SleepyJay
in thread Mason Interp Perl string by SleepyJay

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.