Revision 2 - 2009-11-27 at 16:47:48
  • If a special page needs its own table, it should go under a special schema/database/namespace/whatever; that way, if MojoMojo itself needs such a table in the future, it won't puke.
  • How exactly should we provide i18n for special pages?
  • This is my current idea for a special page that implements a simple counter:
package MojoMojo::Extensions::Counter;

use strict;
use warnings;

use base qw(MojoMojo::Extension)# MM::Extension ISA Catalyst::Controller

sub index :Path :Args(0) {
    my ( $self$c ) = @_;
    $c->detach('view');
}

sub view :Local {
    my ( $self$c ) = @_;
    @{$c->stash}{qw(current_view template count)} = ('TT''extensions/count.tt'$c->session->{count} || 0);
}

sub add :Local {
    my ( $self$c ) = @_;
    my $session = $c->session;
    my $count = $session->{count} || 0;
    $session->{count} = $count + 1;
    $c->res->redirect($c->uri_for('view'));
}

sub subtract :Local {
    my ( $self$c ) = @_;
    my $session = $c->session;
    my $count = $session->{count} || 0;
    $session->{count} = $count - 1;
    $c->res->redirect($c->uri_for('view'));
}
My tags:
 
Popular tags:
 
Powered by Catalyst