Changeset 14071 for lang/perl/Sledge-View/trunk
- Timestamp:
- 06/15/08 23:01:10 (5 years ago)
- Location:
- lang/perl/Sledge-View/trunk
- Files:
-
- 4 added
- 5 modified
-
Makefile.PL (modified) (1 diff)
-
lib/Sledge/Plugin/View.pm (modified) (2 diffs)
-
lib/Sledge/Response.pm (modified) (1 diff)
-
t/00.load.t (modified) (1 diff)
-
t/01.base.t (modified) (2 diffs)
-
t/TestPages.pm (added)
-
t/View (added)
-
t/View/Text.pm (added)
-
t/foo.html (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Sledge-View/trunk/Makefile.PL
r14068 r14071 7 7 8 8 requires 'Class::Accessor::Fast' => 0; 9 build_requires 'Class::Trigger' => 0; 9 10 10 11 auto_install; -
lang/perl/Sledge-View/trunk/lib/Sledge/Plugin/View.pm
r14069 r14071 9 9 10 10 # add BEFORE_OUTPUT trigger 11 $pkg->__trigger_points( 12 %{ $pkg->__trigger_points }, 13 BEFORE_OUTPUT => 1, 11 $pkg->__triggerpoints( 12 { 13 %{ $pkg->__triggerpoints }, 14 BEFORE_OUTPUT => 1, 15 } 14 16 ); 15 17 … … 21 23 my $self = shift; 22 24 23 unless ($self->r ->content_type) {25 unless ($self->res->content_type) { 24 26 # process the default view. 25 27 $self->create_view->process; -
lang/perl/Sledge-View/trunk/lib/Sledge/Response.pm
r14065 r14071 7 7 8 8 1; 9 10 =head1 NAME 11 12 Sledge::Response - response object for Sledge 13 14 =head1 SYNOPSIS 15 16 package Your::Pages; 17 18 sub dispatch_foo { 19 my $self = shift; 20 $self->response->content_type('text/html'); 21 $self->response->body('hoge'); 22 } 23 24 =head1 DESCRIPTION 25 26 HTTP response object for Sledge. 27 28 =head1 METHODS 29 30 =head2 body 31 32 HTTP Response body. 33 34 =head2 content_type 35 36 HTTP Response content_type. 37 38 =head1 BUGS AND LIMITATIONS 39 40 No bugs have been reported. 41 42 =head1 AUTHOR 43 44 Tokuhiro Matsuno C<< <tokuhiro __at__ mobilefactory.jp> >> 45 46 =head1 LICENCE AND COPYRIGHT 47 48 Copyright (c) 2006, Tokuhiro Matsuno C<< <tokuhiro __at__ mobilefactory.jp> >>. All rights reserved. 49 50 This module is free software; you can redistribute it and/or 51 modify it under the same terms as Perl itself. See L<perlartistic>. 52 -
lang/perl/Sledge-View/trunk/t/00.load.t
r14065 r14071 1 use Test::More tests => 1; 1 use strict; 2 use warnings; 3 use Test::More tests => 4; 4 use Class::Trigger qw/AFTER_INIT/; 5 6 sub mk_accessors { 'dummy for testing' } 2 7 3 8 BEGIN { 4 use_ok( 'Sledge::View' ); 9 use_ok( 'Sledge::View' ); 10 use_ok( 'Sledge::Plugin::View' ); 11 use_ok( 'Sledge::View::Template' ); 12 use_ok( 'Sledge::Response' ); 5 13 } 6 14 -
lang/perl/Sledge-View/trunk/t/01.base.t
r14065 r14071 2 2 use warnings; 3 3 use Test::More; 4 4 5 BEGIN { 5 eval q[use Test::Base]; 6 plan skip_all => "Test::Base required for testing base" if $@; 6 eval q[use Test::Base;use t::TestPages]; 7 plan skip_all => "Test::Base, t::TestPages required for testing base: $@" if $@; 8 }; 9 plan tests => 1*blocks; 10 11 run { 12 my $block = shift; 13 14 no warnings 'once'; 15 local *t::TestPages::dispatch_foo = sub { 16 my $self = shift; 17 eval $block->input; 18 die $@ if $@; 19 }; 20 21 my $page = t::TestPages->new; 22 $page->dispatch('foo'); 23 is($page->output, $block->expected, $block->name); 7 24 }; 8 25 … … 11 28 === simple 12 29 --- input 30 $self->tmpl->param(abc => 'foo'); 13 31 --- expected 32 Content-Length: 9 33 Content-Type: text/html; charset=euc-jp 34 35 abc: foo 36 37 === another view 38 --- input 39 use t::View::Text; 40 $self->tmpl->param('text' => "boofy boofy\n"); 41 t::View::Text->new($self)->process; 42 --- expected 43 Content-Length: 12 44 Content-Type: text/plain 45 46 boofy boofy 47
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)