Getting the page source code from a generated MASON-File

Hello,

I have got a MASON code from Ticket/foo.html with a mandatory URL
parameter id, which is set to 11. You can see the page source code in
your browser with View->Page Source. Nevertheless, I want to copy the
generated code to /var/tmp/bar11.html; /var/tmp/ is a directory with
sufficient conditions. If you use $m->comp like I will display in the
code, it does not work.
The code is:

use IO::File;
my $File = new IO::File">/var/tmp/bar$id.html";
Abort("Could not open file!") unless $File;

$PageSource = $m->comp(“/Ticket/foo.html”, id => $id);
print $File $PageSource;
$File->close();

The file bar11.id for $id=11 will be created, as everybody can write
into /var/tmp/, but it is empty. What can I do else, to put the page
source code of a MASON-file into a temporary file? Or is it just
impossible? In CGI it would simply be:

system("foo.pl ‘id=$id’ > /var/tmp/bar$id.html);

Then you would see the page source code of foo.pl?id=11 in
/var/tmp/bar11.pl.

Greetings,

Wolfram

use IO::File;
my $File = new IO::File">/var/tmp/bar$id.html";
Abort(“Could not open file!”) unless $File;
$PageSource = $m->comp(“/Ticket/foo.html”, id => $id);

You want $m->scomp.

Thomas