Difference between revisions of "API:EPrints/Handle/CGI"

From EPrints Documentation
Jump to: navigation, search
Line 37: Line 37:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_get_request -->==get_request==
+
<!-- Pod2Wiki=item_get_request --><div style='border: dashed 1px green'>
 +
==get_request==
  
 
   $request = $handle-&gt;get_request;
 
   $request = $handle-&gt;get_request;
Line 46: Line 47:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_get_query -->==get_query==
+
<!-- Pod2Wiki=item_get_query --><div style='border: dashed 1px green'>
 +
==get_query==
  
 
   $query = $handle-&gt;get_query;
 
   $query = $handle-&gt;get_query;
Line 55: Line 57:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_get_uri -->==get_uri==
+
<!-- Pod2Wiki=item_get_uri --><div style='border: dashed 1px green'>
 +
==get_uri==
  
 
   $uri = $handle-&gt;get_uri
 
   $uri = $handle-&gt;get_uri
Line 64: Line 67:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_get_full_url -->==get_full_url==
+
<!-- Pod2Wiki=item_get_full_url --><div style='border: dashed 1px green'>
 +
==get_full_url==
  
 
   $uri = $handle-&gt;get_full_url
 
   $uri = $handle-&gt;get_full_url
Line 73: Line 77:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_get_secure -->==get_secure==
+
<!-- Pod2Wiki=item_get_secure --><div style='border: dashed 1px green'>
 +
==get_secure==
  
 
   $secure = $handle-&gt;get_secure
 
   $secure = $handle-&gt;get_secure
Line 82: Line 87:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_redirect -->==redirect==
+
<!-- Pod2Wiki=item_redirect --><div style='border: dashed 1px green'>
 +
==redirect==
  
 
   $handle-&gt;redirect( $url, [%opts] )
 
   $handle-&gt;redirect( $url, [%opts] )
Line 91: Line 97:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_send_http_header -->==send_http_header==
+
<!-- Pod2Wiki=item_send_http_header --><div style='border: dashed 1px green'>
 +
==send_http_header==
  
 
   $handle-&gt;send_http_header( %opts )
 
   $handle-&gt;send_http_header( %opts )
Line 106: Line 113:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_param -->==param==
+
<!-- Pod2Wiki=item_param --><div style='border: dashed 1px green'>
 +
==param==
  
 
   $value or @values = $handle-&gt;param( $name )
 
   $value or @values = $handle-&gt;param( $name )
Line 121: Line 129:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_have_parameters -->==have_parameters==
+
<!-- Pod2Wiki=item_have_parameters --><div style='border: dashed 1px green'>
 +
==have_parameters==
  
 
   $bool = $handle-&gt;have_parameters
 
   $bool = $handle-&gt;have_parameters
Line 130: Line 139:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_current_user -->==current_user==
+
<!-- Pod2Wiki=item_current_user --><div style='border: dashed 1px green'>
 +
==current_user==
  
 
   $user = $handle-&gt;current_user
 
   $user = $handle-&gt;current_user
Line 141: Line 151:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_client -->==client==
+
<!-- Pod2Wiki=item_client --><div style='border: dashed 1px green'>
 +
==client==
  
 
   $client = $handle-&gt;client
 
   $client = $handle-&gt;client
Line 158: Line 169:
 
</div>
 
</div>
 
<!-- End of Pod2Wiki -->
 
<!-- End of Pod2Wiki -->
<!-- Pod2Wiki=item_get_http_status -->==get_http_status==
+
<!-- Pod2Wiki=item_get_http_status --><div style='border: dashed 1px green'>
 +
==get_http_status==
  
 
   $status = $handle-&gt;get_http_status
 
   $status = $handle-&gt;get_http_status

Revision as of 15:01, 19 August 2009

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


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.


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();
 

METHODS

get_request

 $request = $handle->get_request;

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


get_query

 $query = $handle->get_query;

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


get_uri

 $uri = $handle->get_uri

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


get_full_url

 $uri = $handle->get_full_url

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


get_secure

 $secure = $handle->get_secure

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


redirect

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

Redirects the browser to $url.


send_http_header

 $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.


param

 $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.


have_parameters

 $bool = $handle->have_parameters

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


current_user

 $user = $handle->current_user

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

Return undef if there isn't one.


client

 $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.


get_http_status

 $status = $handle->get_http_status

Return the status of the current HTTP request.