CatalystX-ASP

 view release on metacpan or  search on metacpan

lib/CatalystX/ASP/Response.pm  view on Meta::CPAN

                && all {/.=./} @{ $cookies{$name}{Value} } ) {
                for ( @{ delete $cookies{$name}{Value} } ) {
                    my ( $key, $val ) = split '=';
                    $cookies{$name}{Value}{$key} = $val;
                }
            }
        }
        return \%cookies;
    },
    traits  => ['Hash'],
    handles => {
        _get_Cookie => 'get',
        _set_Cookie => 'set',
    },
);

# This attribute currently has no effect
has 'Debug' => (
    is      => 'ro',
    isa     => 'Bool',
    default => 0,
    reader  => '_Debug',
);

=item $Response->{Expires}

Sends a response header to the client indicating the $time in SECONDS in which
the document should expire.  A time of C<0> means immediate expiration. The
header generated is a standard HTTP date like: "Wed, 09 Feb 1994 22:23:32 GMT".

=cut

has 'Expires' => (
    is      => 'rw',
    isa     => 'Int',
    default => 0,
);

# This attribute has no effect
has 'ExpiresAbsolute' => (
    is      => 'rw',
    isa     => 'Str',
    default => '',
);

# This attribute has no effect
has 'FormFill' => (
    is      => 'rw',
    isa     => 'Bool',
    default => 0,
);

=item $Response->{IsClientConnected}

1 if web client is connected, C<0> if not. This value starts set to 1, and will
be updated whenever a C<< $Response->Flush() >> is called.

As of Apache::ASP version 2.23 this value is updated correctly before
F<global.asa> C<Script_OnStart> is called, so global script termination may be
correctly handled during that event, which one might want to do with excessive
user STOP/RELOADS when the web server is very busy.

An API extension C<< $Response->IsClientConnected >> may be called for refreshed
connection status without calling first a C<< $Response->Flush >>

=cut

# This attribute has no effect
has 'IsClientConnected' => (
    is      => 'rw',
    isa     => 'Bool',
    default => 1,
);

# This attribute has no effect
has 'PICS' => (
    is      => 'rw',
    isa     => 'Str',
    default => '',
);

=item $Response->{Status}

Sets the status code returned by the server. Can be used to set messages like
500, internal server error

=cut

has 'Status' => (
    is      => 'rw',
    isa     => 'Int',
    default => 0,
);

sub BUILD {
    my ( $self ) = @_;

    no warnings 'redefine';
    *TIEHANDLE = sub {$self};
    $self->{out} = $self->{BinaryRef} = \( $self->{Body} );

    # Don't initiate below attributes unless past setup phase
    return unless $self->asp->_setup_finished;

    # Due to problem mentioned above in the builder methods, we are calling
    # these attributes to populate the values for the hash key to be available
    $self->Cookies;
}

=back

=head1 METHODS

=over

=item $Response->AddHeader($name, $value)

Adds a custom header to a web page. Headers are sent only before any text from
the main page is sent.

=cut



( run in 2.213 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )