⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 request.pm

📁 1. 记录每个帖子的访问人情况
💻 PM
字号:
# Copyright 2001-2005 Six Apart.# SCRiPTMAFiA 2005 - THE DiRTY HANDS ON YOUR SCRiPTS## $Id: Request.pm 10831 2005-03-30 23:27:06Z ezra $package MT::Request;use strict;use MT::ErrorHandler;@MT::Request::ISA = qw( MT::ErrorHandler );use vars qw( $r );sub instance {    return $r if $r;    $r = __PACKAGE__->new;}sub finish { undef $r }sub new {    my $req = bless { __stash => { } }, $_[0];    $req;}sub stash {    my $req = shift;    my $key = shift;    $req->{__stash}->{$key} = shift if @_;    $req->{__stash}->{$key};}*cache = \&stash;1;__END__=head1 NAMEMT::Request - Movable Type request cache=head1 SYNOPSIS    use MT::Request;    my $r = MT::Request->instance;    $r->cache('foo', $foo);    ## Later and elsewhere...    my $foo = $r->cache('foo');=head1 DESCRIPTIONI<MT::Request> is a very simple singleton object which lasts only for oneparticular request to the application, and thus can be used for caching datathat you would like to disappear after the application request exists (and notfor the lifetime of the application).=head1 USAGE=head2 MT::Request->instanceReturns the I<MT::Request> singleton.=head2 $r->cache($key [, $value ])Given a key I<$key>, returns the cached value of the key in the cache held bythe object I<$r>. Given a value I<$value> and a key I<$key>, sets the value ofthe key I<$key> in the cache. I<$value> can be a simple scalar, a reference,an object, etc.=head2 $r->stash($key [, $value ])C<stash> is an alias to C<cache>.=head1 AUTHOR & COPYRIGHTPlease see the I<MT> manpage for author, copyright, and license information.=cut

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -