Moxyのページサイズ取得用プラグイン
書いてみた。お手本があったのでとてもすんなり書けた。
ShowHTMLPageSize.pm
package Moxy::Plugin::ShowHTMLPageSize; use strict; use warnings; use base qw/Moxy::Plugin/; use Encode; sub control_panel :Hook { my ($self, $context, $args) = @_; $context->log(debug => 'dump html pagesize'); return $self->render_template( $context, 'panel.tt' => { pagesize => $args->{response}->header( 'Content-Length' ), } ); } 1; __END__ =head1 NAME Moxy::Plugin::ShowHTMLPageSize - show html pagesize in control panel. =head1 SYNOPSIS - module: ShowHTMLPageSize =head1 DESCRIPTION show html pagesize on control panel, for debugging. =head1 AUTHOR Akiko Yokoyama
panel.tt
<div id="moxy_show_pagesize"> <p>ページサイズ: [% pagesize | html %]bytes</p> </div>
config.yaml
--- global: server: module: ServerSimple args: port: 5000 timeout: 23 log: level: debug session: state: module: BasicAuth store: module: DBM config: file: /tmp/moxy.ndbm dbm_class: NDBM_File plugins: - module: UserID - module: XMLisHTML - module: UserAgentSwitcher - module: RefererCutter - module: CookieCutter - module: FlashUseImgTag - module: DisableTableTag - module: GPS - module: HTTPHeader - module: QRCode - module: ShowHTTPHeaders - module: RelativeLocation - module: ResponseTime - module: Bookmark config: bookmark: 'Yahoo! Mobile': 'http://mobile.yahoo.co.jp/' 'goo Mobile': 'http://mobile.goo.ne.jp/' 'Google Mobile': 'http://www.google.co.jp/imode' 'MSN Mobile': 'http://m.msn.co.jp/' '2ch': 'http://c.2ch.net' '2ch検索': 'http://is.2ch.net' 'イカスミ': 'http://ika.tv/' 'エフルート': 'http://froute.jp/' 'モバゲー': 'http://mbga.jp/' - module: ShowHTMLSource - module: ShowHTMLPageSize