SleepyJay has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to Mason-interpret a dynamically generated script, while keeping all of the Mason variables in tact.
First the easy part. I can configure my server such that a script tag with a source like "/somepath/foo.mjs" will be processed through the normal HTML::Mason::ApacheHandler code and resolve Mason stuff properly. For instance:
"... some script stuff... % print STDERR "Mason is working!\n"; % print STDERR Dumper($m->session); ...more script stuff..."
I get the proper results. Nothing special going on.
The hard part is when my script tag has a source of "/somepath/foo.dynjs". In this case, we have an Apache handler that dynamically generates the output as a Perl string using various mechanisms. Then it serves that back to the client in the usual way. However, if I happen to have a bit of Mason in that output, I cannot seem to figure out how to have Mason interpret it WITH the session in tact, before I send it back.
That is to say, I can take that string and send it through a HTML::Mason::Interp before I serve it to the client. But because that is the "stand-alone" usage, as far as I can tell, the $m->session part is lost. And, because "/somepath/foo.dynjs" does not actually exist as a file, trying to send the $r through the prepare_request call will error out.
This has to be possible. I'm so close. Please help!
Thanks
jason.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mason Interp Perl string
by Anonymous Monk on Feb 09, 2012 at 20:47 UTC | |
by SleepyJay (Beadle) on Feb 09, 2012 at 21:34 UTC | |
by Anonymous Monk on Feb 09, 2012 at 21:46 UTC | |
by SleepyJay (Beadle) on Feb 09, 2012 at 22:43 UTC | |
by Anonymous Monk on Feb 09, 2012 at 23:52 UTC | |
| |
|
Re: Mason Interp Perl string
by SleepyJay (Beadle) on Feb 15, 2012 at 15:21 UTC | |
by SleepyJay (Beadle) on Feb 27, 2012 at 23:37 UTC | |
by Anonymous Monk on Feb 28, 2012 at 12:00 UTC |