Show
Ignore:
Timestamp:
06/15/08 23:01:10 (5 years ago)
Author:
tokuhirom
Message:

r3504@gp (orig r154): tokuhiro | 2006-10-29 21:33:06 +0900

r4587@toco: tokuhiro | 2006-10-29 21:33:02 +0900
many changes.

Location:
lang/perl/Sledge-View/trunk
Files:
4 added
5 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Sledge-View/trunk/Makefile.PL

    r14068 r14071  
    77 
    88requires 'Class::Accessor::Fast' => 0; 
     9build_requires 'Class::Trigger' => 0; 
    910 
    1011auto_install; 
  • lang/perl/Sledge-View/trunk/lib/Sledge/Plugin/View.pm

    r14069 r14071  
    99 
    1010    # 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        } 
    1416    ); 
    1517 
     
    2123        my $self = shift; 
    2224 
    23         unless ($self->r->content_type) { 
     25        unless ($self->res->content_type) { 
    2426            # process the default view. 
    2527            $self->create_view->process; 
  • lang/perl/Sledge-View/trunk/lib/Sledge/Response.pm

    r14065 r14071  
    77 
    881; 
     9 
     10=head1 NAME 
     11 
     12Sledge::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 
     26HTTP response object for Sledge. 
     27 
     28=head1 METHODS 
     29 
     30=head2 body 
     31     
     32HTTP Response body. 
     33 
     34=head2 content_type 
     35 
     36HTTP Response content_type. 
     37 
     38=head1 BUGS AND LIMITATIONS 
     39 
     40No bugs have been reported. 
     41 
     42=head1 AUTHOR 
     43 
     44Tokuhiro Matsuno  C<< <tokuhiro __at__ mobilefactory.jp> >> 
     45 
     46=head1 LICENCE AND COPYRIGHT 
     47 
     48Copyright (c) 2006, Tokuhiro Matsuno C<< <tokuhiro __at__ mobilefactory.jp> >>. All rights reserved. 
     49 
     50This module is free software; you can redistribute it and/or 
     51modify 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; 
     1use strict; 
     2use warnings; 
     3use Test::More tests => 4; 
     4use Class::Trigger qw/AFTER_INIT/; 
     5 
     6sub mk_accessors { 'dummy for testing' } 
    27 
    38BEGIN { 
    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' ); 
    513} 
    614 
  • lang/perl/Sledge-View/trunk/t/01.base.t

    r14065 r14071  
    22use warnings; 
    33use Test::More; 
     4 
    45BEGIN { 
    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}; 
     9plan tests => 1*blocks; 
     10 
     11run { 
     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); 
    724}; 
    825 
     
    1128=== simple 
    1229--- input 
     30$self->tmpl->param(abc => 'foo'); 
    1331--- expected 
     32Content-Length: 9 
     33Content-Type: text/html; charset=euc-jp 
     34 
     35abc: foo 
     36 
     37=== another view 
     38--- input 
     39use t::View::Text; 
     40$self->tmpl->param('text' => "boofy boofy\n"); 
     41t::View::Text->new($self)->process; 
     42--- expected 
     43Content-Length: 12 
     44Content-Type: text/plain 
     45 
     46boofy boofy 
     47