Re: Feature request: printf
"Eric Harrison" <[email protected]> Tue, 26 Sep 2006 05:37:19 -0400
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm with Dave on this one. I hate when I see $m being used in an init block or something and putting something in the output buffer via $m->print or anything else like it. Due to the fact that the various blocks have completely different execution orders, it makes trying to figure out just what will be passed to the end user vary difficult. Is there a reason that you're adament about getting a printf method in $m? Can you provide more information or give us your reasoning behind your request? printf() seems like a valid method to add to $m and would help it fall more in line (API wise) with just about everything programmers come to expect in a development environment, but I'm cautious about what core methods are added just from the threat of feature bloat. -Eric On 9/23/06, Dave Rolsky <[email protected]> wrote: > 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 > _______________________________________________ > Mason-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mason-devel > -- Eric Ryan Harrison, Developer model13 Designs ------------------------------------------------------------------------- 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