Drogo
view release on metacpan or search on metacpan
lib/Drogo/Guts.pm view on Meta::CPAN
=cut
sub auto_header
{
my ($self, $arg) = @_;
if (defined $arg)
{
if ($arg)
{
delete $request_data{disable_auto_header};
}
else
{
$request_data{disable_auto_header} = 1;
}
}
return(not exists $request_data{disable_auto_header});
}
=head3 $self->dispatching
Returns true if we're dispatching actively.
=cut
sub dispatching
{
my ($self, $arg) = @_;
if (defined $arg)
{
if ($arg)
{
delete $request_data{disable_dispatching};
}
else
{
$request_data{disable_dispatching} = 1;
}
}
return(not exists $request_data{disable_dispatching});
}
=head3 $self->header_set('header_type', 'value')
Set output header.
=cut
sub header_set
{
my ($self, $key, $value) = @_;
$request_data{headers}{$key} = $value;
}
=head3 $self->header('content-type')
Set content type.
=cut
sub header
{
my ($self, $value) = @_;
__PACKAGE__->header_set('Content-Type', $value);
}
=head3 $self->headers
Returns hashref of response headers.
=cut
sub headers
{
my ($self, $value) = @_;
return $request_data{headers};
}
=head3 $self->location('url')
Redirect to a url (sets the Location header out).
=cut
sub location { shift->header_set('Location', shift) }
=head3 $self->status(...)
Set output status... (200, 404, etc...)
If no argument given, returns status.
=cut
sub status
{
my ($self, $status) = @_;
if ($status)
{
$request_data{status} = $status;
}
else
{
return $request_data{status};
}
}
# map $self->log to print STDERR
sub log { shift; print STDERR @_; }
=head3 $self->request_part(...)
Returns reference for upload.
( run in 1.507 second using v1.01-cache-2.11-cpan-524268b4103 )