in reply to Re^2: Mason Interp Perl string
in thread Mason Interp Perl string

Try making your handler a HTML::Mason::ApacheHandler subclass, as in
use parent qw/ HTML::Mason::ApacheHandler /;

Replies are listed 'Best First'.
Re^4: Mason Interp Perl string
by SleepyJay (Beadle) on Feb 09, 2012 at 22:43 UTC

    Good idea...I like it...

    But, I'm not familiar with "use parent", and apparently neither is my server (this server is on Perl 5.8.8). I also tried "use base" and a plain old ISA on it, but they didn't work either--although they errored in a different way. :)

    package Mason::MyDynHandler; our @ISA = qw(HTML::Mason::ApacheHandler); use HTML::Mason::ApacheHandler; sub handler { my($r) = @_; my $output = '% print STDERR "$m->session\n"; \n alert("foo");'; my $ah = HTML::Mason::ApacheHandler->handler($r); my $mi = $ah->interp; my $c = $mi->make_component(comp_source => $output); my $realOutput = $mi->exec($c); print $realOutput; return OK; }

    With errors:

    [Thu Feb 9 17:28:39 2012] [error] [Mason] File does not exist: /somep +ath/foo.dynjs [Thu Feb 9 17:28:39 2012] [error] Can't call method "interp" without +a package or object reference at ../Mason/MyDynHandler.pm line 43.\n

    the file does not exist is because foo.dynjs is still a virtual file. And line 43 is "my $mi = $ah->interp;". I can move the problem by replacing $mi with $ah, but it isn't set up correctly, clearly.

        This was a good idea, too. But I can't seem to satisfy all of voodoo going on (Apache::Filter instead of HTML::Mason::Requset, then can't find isa_mason_exception, etc.). Sigh.

        I have to give up for now. I have other work to do and this was supposed to be a quick "what-if" that turned into many more hours than intended.

        I'll probably end up making the script generator code smarter and avoid any Mason tags. Too bad, though.

        thanks
        jason.