Skip to content

Commit

Permalink
updated pod.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yusuke Wada committed Mar 15, 2010
1 parent 811cc13 commit d73bcb4
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
68 changes: 68 additions & 0 deletions lib/Noe.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -126,6 +126,74 @@ Then run with plackup
$ plackup myapp_web.psgi $ plackup myapp_web.psgi
=head2 MAKE YOUR APPLICATION
=head3 Dispatcher
Noe::Dispatcher is HTTPx::Dispatcher based. Write rules on your dispatcher class.
package MyApp::Web::Dispatcher;
use Noe::Dispatcher;
connect '' => { controller => 'Root', action => 'index' };
connect 'hi' => { controller => 'Root', action => 'hi' };
connect 'json' => { controller => 'JSON', action => 'index' };
1;
=head3 Controller
You can write simply.
package MyApp::Web::Controller::Root;
sub index {
my ( $self, $c ) = @_;
$c->render('index', { message => $c->config->{message} } );
}
sub hi {
my ( $self, $c ) = @_;
my $name = $c->req->param('name') || 'no name';
$c->render('hi', { name => $name } );
}
=head3 View
Default view template engine is 'Text::MicroTemplate::Extended'.
Write index.mt and hi.mt in "tmpl" directory.
<h2>Message from Config</h2>
<p><?= $message ?></p>
<h2>GET Request</h2>
<form action="/hi">
<input type="text" name="name" />
<input type="submit">
</form>
Template-Toolkit and JSON views are available now.
If you return as JSON write controller like below.
package MyApp::Web::Controller::JSON;
sub index {
my ( $self, $c ) = @_;
$c->render( { as => 'JSON' }, { message => $c->config->{message} } );
}
1;
=head1 NOT YET
Session is not supported yet.
=head1 WHAT IS "Noe"
The character of my favorite TV animation "true tears".
She said
私...涙、あげちゃったから [ I've presented my tears to my lover. ]
=head1 AUTHOR =head1 AUTHOR
Yusuke Wada E<lt>yusuke at kamawada.comE<gt> Yusuke Wada E<lt>yusuke at kamawada.comE<gt>
Expand Down
3 changes: 3 additions & 0 deletions xt/01_podspell.t
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ psgi
MyApp MyApp
myapp myapp
plackup plackup
JSON
mt
tmpl

0 comments on commit d73bcb4

Please sign in to comment.