API:EPrints/Handle/CGI

From EPrints Documentation
Revision as of 13:14, 20 August 2009 by Cjg (Talk | contribs)

Jump to: navigation, search


EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


API: Core API

Latest Source Code (3.3, 3.2) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints::Handle::CGI - CGI methods for EPrints::Handle

User Comments


SYNOPSIS

 my $user = $handle->current_user;
 EPrints::abort() unless( defined $user );
 
 my $epid = $handle->param( "eprintid" );
 
 $handle->redirect( "http://www.eprints.org/" );
 
 my $current_page_uri = $handle->get_uri();
 

User Comments


DESCRIPTION

This module provides additional methods to EPrints::Handle and is not an object in its own right.

Look at EPrints::Handle for further information on how to access the Handle methods.

User Comments


METHODS

User Comments


$request = $handle->get_request;

Return the Apache request object (from mod_perl) or undefined if this isn't a CGI script.

User Comments


$query = $handle->get_query;

Return the CGI.pm object describing the current HTTP query, or undefined if this isn't a CGI script.

User Comments


$uri = $handle->get_uri

Returns the URL of the current script. Or "undef".

User Comments


$uri = $handle->get_full_url

Returns the URL of the current script plus the CGI params.

User Comments


$secure = $handle->get_secure

Returns true if we're using HTTPS/SSL (checks get_online first).

User Comments


$handle->redirect( $url, [%opts] )

Redirects the browser to $url.

User Comments


$handle->send_http_header( %opts )

Send the HTTP header. Only makes sense if this is running as a CGI script.

Opts supported are:

content_type. Default value is "text/html; charset=UTF-8". This sets the http content type header.

lang. If this is set then a cookie setting the language preference is set in the http header.

User Comments


$value or @values = $handle->param( $name )

Passes through to CGI.pm param method.

$value = $handle->param( $name ): returns the value of CGI parameter $name.

$value = $handle->param( $name ): returns the value of CGI parameter $name.

@values = $handle->param: returns an array of the names of all the CGI parameters in the current request.

User Comments


$bool = $handle->have_parameters

Return true if the current script had any parameters (post or get)

User Comments


$user = $handle->current_user

Return the current EPrints::DataObj::User for this session.

Return undef if there isn't one.

User Comments


$client = $handle->client

Return a string representing the kind of browser that made the current request.

Options are GECKO, LYNX, MSIE4, MSIE5, MSIE6, ?.

GECKO covers mozilla and firefox.

? is what's returned if none of the others were matched.

These divisions are intended for modifying the way pages are rendered not logging what browser was used. Hence merging mozilla and firefox.

User Comments


$status = $handle->get_http_status

Return the status of the current HTTP request.

User Comments