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

Jonathan Swartz <[email protected]> Sat, 13 Aug 2005 23:31:06 -0700
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
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. :)

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.

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.

Jon

> Update of /cvsroot/mason/mason/dist/lib/HTML/Mason/Compiler
> In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22544
>
> Modified Files:
>     ToObject.pm
> Log Message:
> remove naughty block around body which was there to turn off warnings
> we shouldn't turn off anyway (if you're outputting undef you might
> want to know about it, I sure would)
>
>
> Index: ToObject.pm
> ===================================================================
> RCS file: /cvsroot/mason/mason/dist/lib/HTML/Mason/Compiler/ 
> ToObject.pm,v
> retrieving revision 1.80
> retrieving revision 1.81
> diff -u -r1.80 -r1.81
> --- ToObject.pm    13 Aug 2005 15:49:11 -0000    1.80
> +++ ToObject.pm    13 Aug 2005 23:45:50 -0000    1.81
> @@ -190,8 +190,6 @@
>      $self->_output_chunk($p{fh}, \$obj_text, $self- 
> >_subcomponents_footer);
>      $self->_output_chunk($p{fh}, \$obj_text, $self->_methods_footer);
>
> -
> -
>      $self->_output_chunk($p{fh}, \$obj_text,
>                           $self->_constructor( $self->comp_class,
>                                                $params ),
> @@ -320,10 +318,10 @@
>                        "\$m->debug_hook( \$m->current_comp->path )  
> if ( HTML::Mason::Compiler::IN_PERL_DB() );\n\n",
>                        $self->_blocks('init'),
>
> -                      # don't show warnings when appending  
> undefined value to $_outbuf
> -                      "\n{ no warnings 'uninitialized';\n",
> +                      # do not add a block around this, it introduces
> +                      # a separate scope and might break cleanup
> +                      # blocks (or all sort of other things!)
>                        $self->{current_compile}{body},
> -                      "\n}\n",
>
>                        $self->_blocks('cleanup'),
>                        $self->postamble,
>
>
>
> --__--__--
>
> Message: 5
> To: [email protected]
> From: Dave Rolsky <[email protected]>
> Date: Sat, 13 Aug 2005 16:47:59 -0700
> Subject: [Mason-checkins] CVS: mason/dist test.pl,1.8,NONE
> Reply-To: [email protected]
>
> Update of /cvsroot/mason/mason/dist
> In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22857
>
> Removed Files:
>     test.pl
> Log Message:
> where the heck did this thing come from?
>
>
>
>
> --__--__--
>
> Message: 6
> To: [email protected]
> From: Dave Rolsky <[email protected]>
> Date: Sat, 13 Aug 2005 17:03:37 -0700
> Subject: [Mason-checkins] CVS: mason/dist/t 05-request.t,1.62,1.63
> Reply-To: [email protected]
>
> Update of /cvsroot/mason/mason/dist/t
> In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25456
>
> Modified Files:
>     05-request.t
> Log Message:
> shut up warnings from this test (they used to be shut up by the no  
> warnings added to comp bodies)
>
>
> Index: 05-request.t
> ===================================================================
> RCS file: /cvsroot/mason/mason/dist/t/05-request.t,v
> retrieving revision 1.62
> retrieving revision 1.63
> diff -u -r1.62 -r1.63
> --- 05-request.t    13 Aug 2005 15:49:12 -0000    1.62
> +++ 05-request.t    14 Aug 2005 00:03:34 -0000    1.63
> @@ -658,7 +658,8 @@
>      $group->add_support( path => '/support/subdir/longjump_test2',
>                           component => <<'EOF',
>  This is longjump_test2
> -% next;
> +
> +% no warnings 'uninitialized'; next;
>  EOF
>                         );
>
>
>
>
>
> --__--__--
>
> _______________________________________________
> Mason-checkins mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mason-checkins
>
>
> End of Mason-checkins Digest
>
>



-------------------------------------------------------
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