-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ryo Anazawa
committed
Dec 27, 2011
1 parent
4b633a9
commit a8449ac
Showing
2 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
NAME | ||
|
||
Blosxom::Header - Missing interface to modify HTTP headers | ||
|
||
SYNOPSIS | ||
|
||
use Blosxom::Header; | ||
|
||
my $header = Blosxom::Header->new(); | ||
|
||
$header->set( | ||
type => 'text/html;', | ||
status => '304', | ||
cache_control => 'must-revalidate', | ||
); | ||
my $value = $header->get('status'); # 304 Not Modified | ||
my $bool = $header->exists('cache_control'); # 1 | ||
my @keys = $header->keys(); # ('type', 'status', 'cache_control') | ||
|
||
$header->remove('cache_control'); | ||
@keys = $header->keys(); # ('type', 'status') | ||
|
||
$header->remove_all(); | ||
@keys = $header->keys(); # () | ||
|
||
DESCRIPTION | ||
|
||
Blosxom, a weblog application, exports a global variable $header | ||
which is a hash reference. This application passes $header CGI::header() | ||
to generate HTTP headers. | ||
|
||
When plugin writers modify HTTP headers, they must write as follows: | ||
|
||
package foo; | ||
$blosxom::header->{'-status'} = '304 Not Modified'; | ||
|
||
It's obviously bad practice. Blosxom misses the interface to modify | ||
HTTP headers. | ||
|
||
This module allows you to modify them in an object-oriented way. | ||
If loaded, you might write as follows: | ||
|
||
my $header = Blosxom::Header->new(); | ||
$header->set('status' => '304'); | ||
|
||
INSTALLATION | ||
|
||
% perl Makefile.PL | ||
% make | ||
% make test | ||
|
||
DEPENDENCIES | ||
|
||
* Blosxom 2.1.2 | ||
* HTTP::Status | ||
|
||
AUTHOR | ||
|
||
Ryo Anazawa (r-anazawa@shochutairen.com) | ||
|
||
LICENSE AND COPYRIGHT | ||
|
||
Copyright (c) 2011 Ryo Anazawa. All rights reserved. | ||
|
||
This module is free software; you can redistribute it and/or | ||
modify it under the same terms as Perl itself. See L<perlartistic>. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters