Hi,
There was a recent post about trying to run standalone components
within a MasonX::WebApp subclass. I never saw a response, but I have
the same question, so I thought I would post my solution and see if
anyone has a better idea.
In my WebApp subclass I created a method called run_component:
sub run_component {
my $self = shift;
my $interp = HTML::Mason::Interp->new(
comp_root => $Conf->comp_root(),
data_dir => $Conf->data_dir(),
error_mode => 'fatal',
);
$Log->debug("Running component: $_[0]");
my $outbuf = '';
$interp->exec(@_, out_method => \$outbuf);
return $outbuf
}
Then from my subclass methods I can call:
my $text = $self->run_component("/path/to/component.mhtml", %
args_to_component);
This works, but seems, well... unsatisfying!
Is there a way to access the Interp object that was already created
for the request? Or the Request object for that matter? A $m->scomp()
call would work just fine here.
I'm doing the same thing as the original poster, trying to generate
email messages. If anyone has suggestions about a better way to solve
the problem overall, I'm all ears.
Thanks in advance,
Aaron
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users