| Tripletail documentation | Contained in the Tripletail distribution. |
Tripletail::InputFilter::SEO - SEO 入力フィルタ
$TL->setInputFilter(['Tripletail::InputFilter::SEO', 999]);
$TL->setInputFilter('Tripletail::InputFilter::HTML');
$TL->startCgi(
-main => \&main,
);
sub main {
if ($CGI->get('mode') eq 'Foo') {
...
}
}
このフィルタは次のような PATH_INFO からフォーム情報を得る。
foo.cgi/aaa/100/bbb/200 => aaa=100&bbb=200
注意:
このフィルタを Tripletail::Session 及び Tripletail::InputFilter::MobileHTML と併用する場合は、 それらよりも先に呼ばれるように設定しなければならない。
内部メソッド
内部メソッド
Copyright 2006 YMIRLINK Inc.
This framework is free software; you can redistribute it and/or modify it under the same terms as Perl itself
このフレームワークはフリーソフトウェアです。あなたは Perl と同じライセンスの 元で再配布及び変更を行うことが出来ます。
Address bug reports and comments to: tl@tripletail.jp
HP : http://tripletail.jp/
| Tripletail documentation | Contained in the Tripletail distribution. |
# ----------------------------------------------------------------------------- # Tripletail::InputFilter::SEO - SEOå ¥åãã£ã«ã¿ # ----------------------------------------------------------------------------- package Tripletail::InputFilter::SEO; use strict; use warnings; use Tripletail; require Tripletail::InputFilter; our @ISA = qw(Tripletail::InputFilter); # ãã®ãã£ã«ã¿ã¯æ¬¡ã®ãããªPATH_INFOãããã©ã¼ã æ å ±ãå¾ãã # foo.cgi/aaa/100/bbb/200 # => aaa=100&bbb=200 # ãã®ãã£ã«ã¿ãSessionåã³Tripletail::Filter::MobileHTMLã¨ä½µç¨ããå ´å㯠# Tripletail::Filter::MobileHTMLãããå ã«å¼ã°ããããã«è¨å®ããªããã°ãªããªãã 1; sub _new { my $class = shift; my $this = $class->SUPER::_new(@_); $this; } sub decodeCgi { my $this = shift; my $form = shift; my $newform = $this->_formFromPairs( $this->__pairsFromPathInfo); $form->addForm($newform); $this; } sub decodeURL { my $this = shift; my $form = shift; my $url = shift; # ãã©ã°ã¡ã³ãã¯é¤å»æ¸ my $fragment = shift; # URLã®ä½å¦ããPATH_INFOãå§ã¾ã£ã¦ããã®ã # 夿ããæ¹æ³ã¯ç¡ãã $this; } sub __pairsFromPathInfo { # æ»ãå¤: ([[key => value], ...], {key => filename, ...}) # ä½ãkey, valueå ±ã«URLãã³ã¼ãããã¦ããäºãæåã³ã¼ãã¯çã®ã¾ã¾ã my $this = shift; if(!defined($ENV{PATH_INFO})) { return ([], undef); } my @split = map { $this->_urlDecodeString($_) } split m!/!, $ENV{PATH_INFO}; shift @split; # æåã®é ç®ã¯å¸¸ã«ç©ºãPATH_INFOãã¹ã©ãã·ã¥ã§å§ã¾ãçºã my @pairs; while(@split) { if(defined($split[0]) && $split[0] eq 'SEO') { shift(@split); shift(@split); next; } my $key = shift(@split); my $value = shift(@split); if(!defined($value)) { $value = ''; } push @pairs, [$key => $value]; } return (\@pairs, {}); } __END__