Apache-Wombat

 view release on metacpan or  search on metacpan

lib/Apache/Wombat/Response.pm  view on Meta::CPAN

# -*- Mode: Perl; indent-tabs-mode: nil; -*-

package Apache::Wombat::Response;

=pod

=head1 NAME

Apache::Wombat::Response - Apache connector response class

=head1 SYNOPSIS

=head1 DESCRIPTION

Apache connector response class. Extends
B<Wombat::Connector::HttpResponseBase>. Overrides many superclass
methods to delegate to an underlying B<Apache::Request> instance.

=cut

use base qw(Wombat::Connector::HttpResponseBase);
use fields qw(apr);
use strict;
use warnings;

use Apache::Util ();

=pod

=head1 CONSTRUCTOR

=over

=item new($apr)

Create and return an instance, initializing fields to default values.

B<Parameters:>

=over

=item $apr

a B<Apache::Request> instance representing the Apache request record

=back

=back

=cut

sub new {
    my $self = shift;
    my $apr = shift;

    $self = fields::new($self) unless ref $self;
    $self->SUPER::new(@_);

    return $self;
}

=pod

=head1 METHODS

=over

=item addDateHeader($name, $date)

Add a date value for the named response header to the B<Apache>
headers_out table.

B<Parameters:>

=over

=item $name

the name of the response header

=item $date

the additional header value, as the number of seconds since the epoch

=back

=cut

sub addDateHeader {
    my $self = shift;
    my $name = shift;
    my $value = shift;

    return 1 if $self->isCommitted();
    return 1 if $self->isIncluded();

    my $str = Apache::Util::ht_time($value);
    $self->addHeader($name, $str || $value);

    return 1;
}

=pod

=item setDateHeader($name, $date)

Set the date value for the named response header in the B<Apache>
headers_out table.

B<Parameters:>

=over

=item $name

the name of the header

lib/Apache/Wombat/Response.pm  view on Meta::CPAN

#                $self->debug("committed response");
        }
    }

    return 1;
}

=pod

=item getRequestRec()

Return the Apache request record for this Request.

=cut

sub getRequestRec {
    my $self = shift;

    return $self->{apr};
}

=pod

=item setRequestRec($apr)

Set the Apache request record for this Request.

B<Parameters:>

=over

=item $apr

the B<Apache::Request> instance

=back

=cut

sub setRequestRec {
    my $self = shift;
    my $apr = shift;

    $self->{apr} = $apr;

    return 1;
}

=pod

=item recycle()

Release all object references and initialize instances variables in
preparation for use or reuse of this object.

=cut

sub recycle {
    my $self = shift;

    $self->SUPER::recycle();

    $self->{apr} = undef;

    return 1;
}

1;
__END__

=pod

=back

=head1 SEE ALSO

L<Apache>,
L<Apache::Request>,
L<Apache::Table>,
L<Apache::Util>,
L<Wombat::Connector::HttpResponseBase>

=head1 AUTHOR

Brian Moseley, bcm@maz.org

=cut



( run in 4.233 seconds using v1.01-cache-2.11-cpan-302cb4679cc )