[Catalyst] Template::Latex in Catalyst
Yves Räber
yraber at mailup.net
Thu Nov 9 05:34:42 GMT 2006
Thanks for your help, but it don't make any difference.
I added some information here, if maybe it will help.
Here is my exact code in the controller :
sub generate_bill : Local {
my ($self, $c ) = @_;
my $vars = ();
my $res;
my $output;
use Template::Latex;
use Template::Constants qw( :debug );
Template::Latex->latex_paths({
latex => '/usr/bin/latex',
pdflatex => '/usr/bin/pdflatex',
dvips => '/usr/bin/dvips',
});
my $tt = Template::Latex->new({
DEBUG => DEBUG_FILTERS | DEBUG_PLUGINS,
INCLUDE_PATH => '/home/yves/workspace/swixtel/root',
});
$c->log->dumper(Template::Latex->latex_paths());
$res = $tt->process('pdf_template.tt',$vars,\$output);
$c->log->dumper("OUTPUT : $output | RES : $res");
}
And that's the Catalyst debug output :
[info] Swixtel powered by Catalyst 5.7001
You can connect to your server at http://kowhai:3000
[Template::Filters] store(latex, ARRAY(0x9960c24))
[Template::Plugins] fetch(Latex, [ HASH(0x9b6d248) ],
Template::Context=HASH(0x9a93080))
[Template::Plugins] loading Template/Plugin/Latex.pm (PLUGIN_BASE)
[Template::Plugins] calling Template::Plugin::Latex->load()
[Template::Plugins] Latex => Template::Plugin::Latex
[Template::Filters] store(latex, ARRAY(0x9b38040))
[Template::Filters] fetch(latex, <no args>,
Template::Context=HASH(0x9a93080))
Use of uninitialized value in concatenation (.) or string at
/home/yves/workspace/swixtel/script/../lib/Swixtel/Controller/Tasks.pm
line 56.
Use of uninitialized value in concatenation (.) or string at
/home/yves/workspace/swixtel/script/../lib/Swixtel/Controller/Tasks.pm
line 56.
[info] *** Request 1 (0.111/s) [27551] [Thu Nov 9 06:30:03 2006] ***
[debug] "GET" request for "tasks/generate_bill" from "127.0.0.1"
[debug] Path is "tasks/generate_bill"
[debug] $VAR1 = {
'dvips' => '/usr/bin/dvips',
'latex' => '/usr/bin/latex',
'pdflatex' => '/usr/bin/pdflatex'
};
[debug] $VAR1 = 'OUTPUT : | RES : ';
[info] *** Request 1 (0.111/s) [27551] [Thu Nov 9 06:30:03 2006] ***
[debug] "GET" request for "tasks/generate_bill" from "127.0.0.1"
[debug] Path is "tasks/generate_bill"
[debug] $VAR1 = {
'dvips' => '/usr/bin/dvips',
'latex' => '/usr/bin/latex',
'pdflatex' => '/usr/bin/pdflatex'
};
[debug] $VAR1 = 'OUTPUT : | RES : ';
Wade.Stuart at fallon.com wrote:
>
>
>
>
> Yves Räber <yraber at mailup.net> wrote on 11/08/2006 12:33:09 PM:
>
>
>> Hi,
>>
>> I'm trying to use Template::Latex to create PDF files.
>>
>> My code looks like this :
>>
>> use Template::Latex;
>>
>> my $tt = Template::Latex->new({
>> INCLUDE_PATH => '/templates',
>> OUTPUT_PATH => '/tmp/pdf'
>> LATEX_FORMAT => 'pdf',
>> });
>>
>> my $vars = {
>> title => 'Hello World',
>> }
>> my $output;
>>
>> $tt->process('example.tt2', $vars, \$output, binmode => 1)
>> || die $tt->error();
>>
>> This works fine in a standalone application, but when I copy this code
>>
> into by
>
>> Catalyst Controller it behaves otherwise, there is no output at all, and
>>
> no
>
>> error or warning message even when using Template debug options (the
>>
> $output
>
>> variable keeps empty)
>>
>> I also tried with a filename in the third parameters of the 'process'
>>
> method
>
>> and I get the same result : works fine in standalone application (I get
>>
> my
>
>> nice PDF in the output path), but no file gets created when run in the
>> catalyst controller.
>>
>> Maybe I'm missing something really obvious, but right now I have no idea
>>
> what
>
>> to do to make it work.
>>
>> Did anyone tried to do the same thing with success ?
>>
>> Thank you.Catalyst at lists.rawmode.org
>>
>> Yves Raber
>>
>>
>
> Maybe it is having issues finding the binaries needed to do the
> conversions:
>
> Template::Latex->latex_paths({
> latex => '/usr/bin/latex',
> pdflatex => '/usr/bin/pdflatex',
> dvips => '/usr/bin/dvips',
> });
>
>
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
More information about the Catalyst
mailing list