Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

slanning (5049)

slanning
  (email not shown publicly)
http://search.cpan.org/~slanning/

Scott Lanning is currently working in Amsterdam at a hotel-booking company. The following interviews and commentaries are for entertainment only. The views and opinions expressed therein do not necessarily represent the views of his employer or even himself.

Journal of slanning (5049)

Monday March 31, 2008
08:12 AM

Continuity and templating

[ #36011 ]

I like the idea of Continuity. I don't, however, want to go back to using CGI.pm (or printing strings directly) to generate HTML. That's probably what Brock has in mind with Continuity::Widget. However, sorry, I also don't want to use a widget system hacked up just for Continuity, and that module seems to only be a placeholder right now anyway.

What I'd really like to do is somehow integrate Continuity with my favorite templating system, HTML::Mason. Are these two too different conceptually, though? Mason is based on requests, while Continuity is trying to get rid of them? Not sure yet how Continuity's Mapper and Adapter objects fit with Mason's Request, Resolver, ApacheHandler, Interpret... Anyone have ideas?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Yeah, Continuity::Widget is just a sketch, and separate from Continuity itself on purpose. Even if I get that going the way I like, I definitely don't expect it to be The Way to use Continuity. More like a demonstration of what can be done. Well... and for my own use :)

    I unfortunately don't know the full HTML::Mason request cycle and how that all works. One thing you can do, I believe, is to just use Mason as a template engine. You could then use Mason components to organize your views, and outter Continu

  • use Mason's templating parts, not its web framework parts, like you would with Catalyst or Jifty. see the source of Catalyst::View::Mason, and the "using Mason in standalone scripts" part of HTML::Mason::Admin.
    • (I'll be damned if I can get the code to format within <code> tags, so this is all Code format.)

      I actually tried installing Jifty last night because I realized it might be more what I had in mind (continuations, Mason...), but I aborted the install after about a half hour of exciting CPAN action. (Maybe I should try Catalyst I guess, but it's never really felt right to me..)

      Then I ended up doing just what you mentioned, using Mason as a standalone script. It wasn't very elegant, though. Unfortunately
      • Yeah. In larger apps I usually end up putting $request into an instance variable so that I don't have to pass it around all the time. You can do the same thing with your Mason interpreter, I imagine your main body might look like:

        sub main {
            my $request = shift;
            my $app = App->new(request => $request);
            $app->run;
        }

        package App.pm;
        # ...

        sub run {
            my $self = shift;
            $self->display('/one.html');
            my $num1 = $self->param('num