Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 120471
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: immute [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 2.24
Fixed in: (no value)



Subject: printf() doesn't work in a PERL block
This code doesn't work: [% PERL %] printf "The current timestamp is %d\n", time(); [% END %] When tested using echo -e '[% PERL %]\nprintf("Hello %d\n", 42);[% END %]' | tpage --eval_perl I get this error: undef error - Can't locate object method "PRINTF" via package "Template::TieString" at (eval 5) line 3, <STDIN> line 1. It seems the PERLOUT filehandle is tied to a Template::TieString object, and that class doesn't implement the PRINTF method. A workaround is using print(sprintf(...)) instead of just printf(...).
Ticket migrated to github as https://github.com/abw/Template2/issues/138