usage of sledge::view

tokuhirom on 2006-11-04T15:12:25

follow is an examle trigger code of Sledge::View.

package Your::Pages::Base;
use strict;
use warnings;
use base qw/Sledge::Pages::Compat/;
use Switch;
use Jcode;
use Sledge::Plugin::PluginLoader;
__PACKAGE__->load_plugins(
  qw/Stash View/
);

__PACKAGE__->add_trigger( AFTER_DISPATCH => sub { my $self = shift;

switch ($self->r->param('output')) { case 'csv' { $self->view('Sledge::View::CSV')->process; $self->response->body(Jcode->new($self->response->body, 'euc')->sjis); } else { $self->view('Template')->process; } } } );

1;