Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

That's how Mason works after all, but using a single output buffer. Ok, that's shallow, I hope the fellow masonites will forgive me for this one ;-)

You should be able to quickly build yourself such a "multi-pass" system using your own conventions, following Mason's request cycle (briefly: gather output by running orderly each component in the inheritance chain)

For the sake of example, here's a possible approach for such an autohandler:

<%doc> # document everything (conventions, hacks etc) :P~ </%doc> <%once> # load modules at this step only if you're not able to load them "a +t startup" # (e.g. preloading them under a mod_perl enabled HTTPd) use My::App; </%once> <%init> # set up runtime/dynamic default configuration parameters $m->comp( '_conf', %ARGS ); # ^ these should all be "notes" ($m->notes) # a <%shared> replacement (yeah, that's me, # I always avoided it for not doing what I meant) ;-/ if ( $m->request_comp->method_exists('_init') ) { $m->request_comp->call_method('_init', %ARGS); } # fetch page content $m->notes( 'page_content' => $m->scomp( $m->fetch_next, %ARGS ) ); # ^ remember that you have to *handle* the "exceptions" # <%cleanup> replacement if ( $m->request_comp->method_exists('_cleanup') ) { $m->request_comp->call_method( '_cleanup', %ARGS ); } # render output return $m->comp( '_render', %ARGS ); </%init>
Also notice that you can optimize this by moving out more app. logic into your My::App modules ;-)


In reply to Re^3: Output should have multiple segments by AltBlue
in thread Output should have multiple segments by John M. Dlugosz

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    Domain Nodelet?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others having a coffee break in the Monastery: (1)
    As of 2024-07-19 21:39 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found

      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.