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

From EPrints Documentation
Jump to: navigation, search
Line 6: Line 6:
  
  
<!-- Pod2Wiki=head_name --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=head_name --></div>
 
==NAME==
 
==NAME==
 
'''EPrints::Handle::CGI''' - CGI methods for EPrints::Handle
 
'''EPrints::Handle::CGI''' - CGI methods for EPrints::Handle
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=head_description --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=head_description --></div>
 
==DESCRIPTION==
 
==DESCRIPTION==
 
This module provides additional methods to EPrints::Handle and is not an object in its own right.
 
This module provides additional methods to EPrints::Handle and is not an object in its own right.
Line 20: Line 21:
 
Look at EPrints::Handle for further information on how to access the  Handle methods.
 
Look at EPrints::Handle for further information on how to access the  Handle methods.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=head_synopsis --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=head_synopsis --></div>
 
==SYNOPSIS==
 
==SYNOPSIS==
 
   my $user = $handle-&gt;current_user;
 
   my $user = $handle-&gt;current_user;
Line 35: Line 37:
 
   my $current_page_uri = $handle-&gt;get_uri();
 
   my $current_page_uri = $handle-&gt;get_uri();
 
    
 
    
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=head_methods --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=head_methods --></div>
 
==METHODS==
 
==METHODS==
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_get_request --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_get_request --></div>
 
===get_request===
 
===get_request===
  
Line 52: Line 56:
 
Return the Apache request object (from mod_perl) or undefined if  this isn't a CGI script.
 
Return the Apache request object (from mod_perl) or undefined if  this isn't a CGI script.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_get_query --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_get_query --></div>
 
===get_query===
 
===get_query===
  
Line 63: Line 68:
 
Return the CGI.pm object describing the current HTTP query, or  undefined if this isn't a CGI script.
 
Return the CGI.pm object describing the current HTTP query, or  undefined if this isn't a CGI script.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_get_uri --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_get_uri --></div>
 
===get_uri===
 
===get_uri===
  
Line 74: Line 80:
 
Returns the URL of the current script. Or "undef".
 
Returns the URL of the current script. Or "undef".
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_get_full_url --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_get_full_url --></div>
 
===get_full_url===
 
===get_full_url===
  
Line 85: Line 92:
 
Returns the URL of the current script plus the CGI params.
 
Returns the URL of the current script plus the CGI params.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_get_secure --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_get_secure --></div>
 
===get_secure===
 
===get_secure===
  
Line 96: Line 104:
 
Returns true if we're using HTTPS/SSL (checks get_online first).
 
Returns true if we're using HTTPS/SSL (checks get_online first).
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_redirect --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_redirect --></div>
 
===redirect===
 
===redirect===
  
Line 107: Line 116:
 
Redirects the browser to $url.
 
Redirects the browser to $url.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_send_http_header --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_send_http_header --></div>
 
===send_http_header===
 
===send_http_header===
  
Line 124: Line 134:
 
lang. If this is set then a cookie setting the language preference is set in the http header.
 
lang. If this is set then a cookie setting the language preference is set in the http header.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_param --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_param --></div>
 
===param===
 
===param===
  
Line 141: Line 152:
 
@values = $handle-&gt;param: returns an array of the names of all the CGI parameters in the current request.
 
@values = $handle-&gt;param: returns an array of the names of all the CGI parameters in the current request.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_have_parameters --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_have_parameters --></div>
 
===have_parameters===
 
===have_parameters===
  
Line 152: Line 164:
 
Return true if the current script had any parameters (post or get)
 
Return true if the current script had any parameters (post or get)
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_current_user --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_current_user --></div>
 
===current_user===
 
===current_user===
  
Line 165: Line 178:
 
Return undef if there isn't one.
 
Return undef if there isn't one.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_client --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_client --></div>
 
===client===
 
===client===
  
Line 184: Line 198:
 
These divisions are intended for modifying the way pages are rendered not logging what browser was used. Hence merging mozilla and firefox.
 
These divisions are intended for modifying the way pages are rendered not logging what browser was used. Hence merging mozilla and firefox.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
<!-- Pod2Wiki=item_get_http_status --><div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'>
+
<!-- Pod2Wiki=item_get_http_status --></div>
 
===get_http_status===
 
===get_http_status===
  
Line 195: Line 210:
 
Return the status of the current HTTP request.
 
Return the status of the current HTTP request.
  
</div><!-- End of Pod2Wiki -->
+
<div style='background-color: #eef; margin: 1em 0em 1em 0em; border: solid 1px #cce;  padding: 1em;'><!-- End of Pod2Wiki -->
 +
 
 
====comments====
 
====comments====
  
 
====comments====
 
====comments====
 
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->
 
<!-- Pod2Wiki=_postamble_ --><!-- End of Pod2Wiki -->

Revision as of 15:26, 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

comments

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.

comments

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

comments

comments

METHODS

comments

comments

get_request

 $request = $handle->get_request;

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

comments

comments

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.

comments

comments

get_uri

 $uri = $handle->get_uri

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

comments

comments

get_full_url

 $uri = $handle->get_full_url

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

comments

comments

get_secure

 $secure = $handle->get_secure

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

comments

comments

redirect

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

Redirects the browser to $url.

comments

comments

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.

comments

comments

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.

comments

comments

have_parameters

 $bool = $handle->have_parameters

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

comments

comments

current_user

 $user = $handle->current_user

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

Return undef if there isn't one.

comments

comments

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.

comments

comments

get_http_status

 $status = $handle->get_http_status

Return the status of the current HTTP request.

comments

comments