Changeset 14688
- Timestamp:
- 06/27/08 14:07:55 (5 years ago)
- Location:
- lang/perl/Catalyst-View-MobileJpFilter/trunk
- Files:
-
- 10 added
- 3 modified
-
. (modified) (1 prop)
-
Makefile.PL (modified) (1 diff)
-
lib/Catalyst/View/MobileJpFilter.pm (modified) (2 diffs)
-
t/01_filter.t (added)
-
t/lib (added)
-
t/lib/HTML (added)
-
t/lib/HTML/MobileJp (added)
-
t/lib/HTML/MobileJp/Filter (added)
-
t/lib/HTML/MobileJp/Filter/Dummy.pm (added)
-
t/lib/TestApp (added)
-
t/lib/TestApp.pm (added)
-
t/lib/TestApp/View (added)
-
t/lib/TestApp/View/MobileJpFilter.pm (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Catalyst-View-MobileJpFilter/trunk
-
Property
svn:ignore set
to
MANIFEST
-
Property
svn:ignore set
to
-
lang/perl/Catalyst-View-MobileJpFilter/trunk/Makefile.PL
r14686 r14688 4 4 all_from 'lib/Catalyst/View/MobileJpFilter.pm'; 5 5 6 requires 'Foo::Bar'; 6 requires 'Catalyst::Runtime' => '5.70'; 7 requires 'Catalyst::Plugin::MobileAgent'; 8 requires 'HTML::MobileJp::Filter'; 9 requires 'Data::Visitor::Callback'; 7 10 8 11 build_requires 'Test::More'; 12 build_requires 'Encode::JP::Mobile'; 9 13 10 14 auto_include; -
lang/perl/Catalyst-View-MobileJpFilter/trunk/lib/Catalyst/View/MobileJpFilter.pm
r14687 r14688 2 2 use strict; 3 3 use warnings; 4 our $VERSION = '0.01'; 5 4 6 use base 'Catalyst::View'; 5 6 7 use Class::C3; 7 8 use Data::Visitor::Callback; … … 34 35 } 35 36 37 sub render { 38 my ($self, $c) = @_; 39 40 $self->html_filter->filter( 41 mobile_agent => $c->req->mobile_agent, 42 html => $c->res->body || "", 43 ); 44 } 45 36 46 sub process { 37 47 my ($self, $c) = @_; 38 48 39 my $html = $self->html_filter->filter( 40 mobile_agent => $c->req->mobile_agent, 41 html => $c->res->body || "", 42 ); 43 44 $c->res->body($html); 45 49 if ($c->res->content_type =~ /html$|xhtml\+xml$/) { 50 $c->res->body( $self->render($c) ); 51 } 52 46 53 return 1; 47 54 } 48 55 49 56 1; 57 __END__ 58 59 =encoding utf-8 60 61 =head1 NAME 62 63 Catalyst::View::MobileJpFilter - Filtering HTML for Japanese cellphone 64 65 =head1 DESCRIPTION 66 67 Catalyst::View::MobileJpFilter is a simple adapter to use 68 L<HTML::MobileJp::Filter> as Catalyst view class. 69 70 =head1 SYNOPSIS 71 72 package MyApp::View::MobileJpFilter; 73 use strict; 74 use base 'Catalyst::View::MobileJpFilter'; 75 76 use YAML; 77 78 __PACKAGE__->config(YAML::Load <<'...' 79 --- 80 filters: 81 - module: DoCoMoCSS 82 config: 83 base_dir: __path_to(root)__ 84 - module: DoCoMoGUID 85 - module: FallbackImage 86 config: 87 template: '<img src="%s.gif" />' 88 params: 89 - unicode_hex 90 ... 91 ); 92 93 1; 94 95 =head1 CONFIGURATION 96 97 Same as L<HTML::MobileJp::Filter>. 98 99 =head1 HOW TO USE 100 101 Use as follows from your controller. 102 103 $c->forward( $c->view('TT') ); # making $c->res->body 104 $c->forward( $c->view('MobileJpFilter') ); # filtering $c->res->body 105 106 Or with L<RenderView|Catalyst::Action::RenderView>. 107 108 sub render :ActionClass('RenderView') { } 109 110 sub end :Private { 111 my ($self, $c) = @_; 112 $c->forward('render'); 113 } 114 115 =head1 AUTHOR 116 117 Naoki Tomita E<lt>tomita@cpan.orgE<gt> 118 119 =head1 LICENSE 120 121 This library is free software; you can redistribute it and/or modify 122 it under the same terms as Perl itself. 123 124 =head1 SEE ALSO 125 126 L<HTML::MobileJp::Filter> 127 128 L<http://coderepos.org/share/browser/lang/perl/Catalyst-View-MobileJpFilter> (repository) 129 130 =cut
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)