Re: Mason-checkins digest, Vol 1 #740 - 6 msgs

Dave Rolsky <[email protected]> Sun, 14 Aug 2005 08:58:42 -0500 (CDT)
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Sat, 13 Aug 2005, Jonathan Swartz wrote:

> Dave: Naughtiness of the block nonwithstanding, I DO want to silently ignore 
> undef in the output. We just might need to find a better way to do it. This 
> undef suppression has been in Mason for a long time in the implementation of 
> Request::print:
>
>    foreach my $text (@_) {
>        $$bufref .= $text if defined($text);
>    }
>
> It was originally put in for syntax like
>
>  <% $m->call_next %>
>
> which people still do use in droves, though I know you can't stand it. :)

Sure, that's legit, but it's _way_ different than turning off warnings, 
which is more like a nuclear weapon than tweezers.

For example:

  % my $x;
  <% $x + 2 %>

That should print an uninit warning.

> The reason for the new extra block and 'no warn' is that when 
> enable_autoflush is turned off, we no longer call $m->print, but instead just 
> append to a local string directly. Try setting enable_autoflush to 0 and 
> you'll see what I mean. I don't want to spew extra warnings - or change any 
> other visible behavior -  when this optimization is used...it should be a 
> totally transparent optimization other than the disabling of autoflush.

Sure, I got that.

> If we allow the warnings in one case, then we have to allow them in the other 
> case as well (meaning take the if defined check out of Request::print). But I 
> have no idea how many innocuous warnings will suddenly manifest. It's 
> definitely a backward incompatibility.

We could probably do something like this:

  $$bufref .= $_ for grep { defined } (...);

But what we really need is a test first.


-dave

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


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf