Re: ToObject "preamble" Parameter

Jonathan Swartz <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>

David Wheeler wrote:

> On Sep 16, 2004, at 10:32 AM, Dave Rolsky wrote:
> 
>>>>>    http://www.masonhq.com/resources/todo/view.html?id=551
>>>>
>>>>
>>>> I think the patch is probably.
>>>
>>>
>>> Uh, was there more to that sentence? ;-)
>>
>>
>> Oops, "probably ok".
> 
> 
> Uh, but then you went and added specific support for the prsence of $m 
> in the premable, Dave:
> 
> --- lib/HTML/Mason/Compiler/ToObject.pm.~1.71.2.3~      Mon Sep 27 
> 22:21:56 2004
> +++ lib/HTML/Mason/Compiler/ToObject.pm Mon Sep 27 22:21:20 2004
> @@ -354,9 +354,9 @@
>  {
>      my $self = shift;
> 
> -    return join '', ( $self->preamble,
> -                      $self->_set_request,
> -                     $self->_arg_declarations,
> +    return join '', ( $self->_set_request,
> +                     $self->preamble,
> +                      $self->_arg_declarations,
>                        $self->_filter,
>                       "\$m->debug_hook( \$m->current_comp->path ) if ( 
> \%DB:: );\n\n",
>                       $self->_blocks('init'),
> @@ -612,11 +612,15 @@
> 
>  =item preamble
> 
> -Text given for this parameter is placed at the beginning of each 
> component. See also P<postamble>.
> +Text given for this parameter is placed at the beginning of each
> +component.  See also P<postamble>.  The request will be available as
> +C<$m> in preamble code.
> 
>  =item postamble
> 
> -Text given for this parameter is placed at the end of each component. 
> See also P<preamble>.
> +Text given for this parameter is placed at the end of each
> +component. See also P<preamble>.  The request will be available as
> +C<$m> in postamble code.
> 
>  =item use_strict
> 
> 
> But IMO, it should be executed before the %once block, e.g., so I can 
> set "use utf8;\n" as the preamble and be assured that everything in the 
> rest of every component will be utf8.
> 
> So maybe we actually need some other parameter for this, like pre-once 
> or something?
> 

I haven't been following this closely, but as far as that last
suggestion - oh lord, please no. I'd almost rather implement a use_utf8
flag. :)

Seriously, is it something that more and more peple are going to need to do?

Jon






-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.