• 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'));
}

Issues with current implementation

  • I'd prefer it not to mess with MM::prepare_path. Look at other controllers (ex. Admin) to see how they do it.
  • i18n
  • Add note to README about extension/special page installation
  • Maybe instead of being under MM::Extensions, special pages should have their own namespace?
  • Improve the look of the counter page
  • Currently, special pages are just controllers. That's nice, but being able to drop in another Catalyst app (ex. Angerwhale) would be really cool. Maybe that's outside the scope of special pages, though.
  • Tests:
    • Configuration
    • i18n
    • counter.add vs counter/.add
    • test different dispatchers
    • /special/counter.view should work, while /counter.view should not
  • I don't know if I like having to specify :Path('/counter.add') for controllers
My tags:
 
Popular tags:
 
Powered by Catalyst