Re: Delayed output generation feature?

"Jonathan Swartz" <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
I too would like a way for pages to easily control things in the autohandler
like title and additions to the <head> and <body> tag. And when I say
easily, I mean without having to write Perl on the pages.

As Dave says, methods/attributes have proved inadequate for this purpose.
The order of execution is strange, you have to use shared variables to avoid
duplicate computation, and your title (or <head> additions, or whatever)
might be determined somewhere other than your main request component.

On masonhq.com we solve this by allowing special tags to be inserted
anywhere in content:

   <mhq:title>My title</mhq:title>

<mhq:body>onLoad="self.focus();document.choose.wiki_name.focus()"</mhq:body>

then parse these out in the autohandler. Yes, HTML scanning is a little
hacky, but it feels a LOT friendlier to me than putting

    <%perl>
    $m->notes('title' => 'My title');
    $m->notes('body' => 'onLoad...');
    </%perl>

on pages. In other words I'd rather do a little scanning in the autohandler
and provide a nice "API" for pages, than require each page to write Perl
code.

Does this tag solution appeal to anyone besides me? :) Would it be worth
making more generic, perhaps (as Doug suggested) in a plugin?

Jon

----- Original Message -----
From: "Alex Robinson" <[email protected]>
To: "Dave Rolsky" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, February 01, 2005 4:32 AM
Subject: Re: [Mason-devel] Delayed output generation feature?


> >I assume you mean something like:
> >
> >  my $output = $m->scomp( $m->fetch_next );
>
>
> Yes, you're right. That's exactly what my actual code says. Once I'd
> figured it out, I just moved swiftly on and forgot the specific
> implementation details. Hmmm, maybe there should be a scall_next ;)
>
>
>
> >>  Is there anything that delayed_output would add that this simple
> >>use of existing functionality doesn't?
> >
> >I can't think of anything.
>
> Case closed I guess.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> Tool for open source databases. Create drag-&-drop reports. Save time
> by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> _______________________________________________
> Mason-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mason-devel
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
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.