App::Mobirc::Plugin::StickyTime - f*cking au cache


mobirc documentation Contained in the mobirc distribution.

Index


Code Index:

NAME

Top

App::Mobirc::Plugin::StickyTime - f*cking au cache

DESCRIPTION

Top

au phone cache very strongly like IE's Ajax.

this filer appends ?t=time() to `a' tag.

this module load to core automatically.

AUTHOR

Top

tokuhirom

SEE ALSO

Top

App::Mobirc


mobirc documentation Contained in the mobirc distribution.

package App::Mobirc::Plugin::StickyTime;
use strict;
use MooseX::Plaggerize::Plugin;
use App::Mobirc::Util;
use HTML::StickyQuery;
use App::Mobirc::Validator;

hook response_filter => sub {
    my ($self, $global_context, $res) = validate_hook('response_filter', @_);

    if (my $loc = $res->header('Location')) {
        my $joinner = ($loc =~ /\?/) ? '&' : '?';
        $loc = $loc . $joinner . "t=@{[ time() ]}";
        return $res->header( Location => $loc );
    }
};

hook html_filter => sub {
    my ($self, $global_context, $req, $content) = validate_hook('html_filter', @_);

    my $sticky = HTML::StickyQuery->new();

    return (
        $req,
        $sticky->sticky(
            scalarref => \$content,
            param     => { t => time() },
        )
    );
};

1;
__END__