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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |