Tripletail
view release on metacpan or search on metacpan
lib/Tripletail/InputFilter/SEO.pm view on Meta::CPAN
# -----------------------------------------------------------------------------
# Tripletail::InputFilter::SEO - SEOå
¥åãã£ã«ã¿
# -----------------------------------------------------------------------------
package Tripletail::InputFilter::SEO;
use base 'Tripletail::InputFilter';
use strict;
use warnings;
use Tripletail;
# ãã®ãã£ã«ã¿ã¯æ¬¡ã®ãããª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__
=encoding utf-8
=for stopwords
SEO
YMIRLINK
decodeCgi
decodeURL
=head1 NAME
Tripletail::InputFilter::SEO - SEO å
¥åãã£ã«ã¿
=head1 SYNOPSIS
$TL->setInputFilter(['Tripletail::InputFilter::SEO', 999]);
$TL->setInputFilter('Tripletail::InputFilter::HTML');
$TL->startCgi(
-main => \&main,
);
sub main {
if ($CGI->get('mode') eq 'Foo') {
...
}
}
=head1 DESCRIPTION
ãã®ãã£ã«ã¿ã¯æ¬¡ã®ãã㪠C<PATH_INFO> ãããã©ã¼ã æ
å ±ãå¾ãã
foo.cgi/aaa/100/bbb/200
=> aaa=100&bbb=200
注æ:
ãã®ãã£ã«ã¿ã L<Tripletail::Session> åã³ L<Tripletail::InputFilter::MobileHTML>
( run in 0.927 second using v1.01-cache-2.11-cpan-71847e10f99 )