git.shiar.nl
/
perl
/
plp
/
.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
v3.17 release
[perl/plp/.git]
/
PLP
/
Tie
/
Headers.pm
diff --git
a/PLP/Tie/Headers.pm
b/PLP/Tie/Headers.pm
index e5f79a8a8cdd4c4ca5649eb00c93e74522cc85e7..163ce5424ba968f234958989e4b6fe6f7ee29ac2 100644
(file)
--- a/
PLP/Tie/Headers.pm
+++ b/
PLP/Tie/Headers.pm
@@
-1,6
+1,5
@@
-#----------------------------#
- package PLP::Tie::Headers;
-#----------------------------#
+package PLP::Tie::Headers;
+
use strict;
use Carp;
use strict;
use Carp;
@@
-11,16
+10,18
@@
the same as C<$foo{'Content-Type'}>.
tie %somehash, 'PLP::Tie::Headers';
tie %somehash, 'PLP::Tie::Headers';
+This module is part of the PLP internals and probably not of much use to others.
+
=cut
=cut
-sub _lc($) {
+sub _lc
($) {
local $_ = $_[0];
tr/_/-/;
return lc;
}
sub TIEHASH {
local $_ = $_[0];
tr/_/-/;
return lc;
}
sub TIEHASH {
- return bless [ # Defaults
.
+ return bless [ # Defaults
{
'Content-Type' => 'text/html',
'X-PLP-Version' => $PLP::VERSION,
{
'Content-Type' => 'text/html',
'X-PLP-Version' => $PLP::VERSION,
@@
-39,10
+40,15
@@
sub FETCH {
sub STORE {
my ($self, $key, $value) = @_;
sub STORE {
my ($self, $key, $value) = @_;
- croak 'Can\'t set headers after sending them!' if $PLP::sentheaders;
+ if ($PLP::sentheaders) {
+ my @caller = caller;
+ die "Can't set headers after sending them at " .
+ "$caller[1] line $caller[2].\n(Output started at " .
+ "$PLP::sentheaders->[0] line $PLP::sentheaders->[1].)\n"
+ }
if (defined $self->[1]->{_lc $key}){
$key = $self->[1]->{_lc $key};
if (defined $self->[1]->{_lc $key}){
$key = $self->[1]->{_lc $key};
- }
else
{
+ }
else
{
$self->[1]->{lc $key} = $key;
}
return ($self->[0]->{$key} = $value);
$self->[1]->{lc $key} = $key;
}
return ($self->[0]->{$key} = $value);