Apache2-WebApp-Plugin-CGI

 view release on metacpan or  search on metacpan

lib/Apache2/WebApp/Plugin/CGI.pm  view on Meta::CPAN


#~~~~~~~~~~~~~~~~~~~~~~~~~~[  OBJECT METHODS  ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

#----------------------------------------------------------------------------+
# params(\%controller)
#
# Get the request paramters; return name/value parameters as a hash.

sub params {
    my ( $self, $c )
      = validate_pos( @_,
          { type => OBJECT  },
          { type => HASHREF }
          );

    return
      ( map { $_ => $c->request->param($_) || "" } $c->request->param() );
}

#----------------------------------------------------------------------------+
# redirect( \%controller, $target )
#
# Redirect an HTTP request to a target URI/URL.

sub redirect {
    my ( $self, $c, $target )
      = validate_pos( @_,
          { type => OBJECT  },
          { type => HASHREF },
          { type => SCALAR  },
          );

    my $status = $c->request->protocol eq "HTTP/1.1" ? 303 : 302;

    $c->request->status($status);
    $c->request->headers_out->set( 'Location' => $target );
    $c->request->headers_out();



( run in 0.543 second using v1.01-cache-2.11-cpan-a5abf4f5562 )