Re: Feature request: printf

Dave Rolsky <[email protected]> Sat, 23 Sep 2006 14:06:37 -0500 (CDT)
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Fri, 22 Sep 2006, Jeremy Blain wrote:

> I often find myself having to do:
> $m->print(sprintf('some pattern', $var1, $var2));
>
> It would be really nice to have $m->printf just as a shortcut.
>
> The function seems simple, and I would have submitted a patch,
> but the test kit was taking too long to wrap my head around, and
> I know you much prefer patches with tests.
>
> # Request.pm
> sub printf {
>    my $self = shift;
>    $self->print(sprintf(shift, @_));
> }

Is it that hard to do:

  <% sprintf( ... ) %>

?

Philosophically, I'm somewhat opposed to adding features that encourage 
people to use $m to generate output, since it inverts the normal sense of 
templates, and makes for messier templates.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV