Difference between revisions of "API:EPrints"

From EPrints Documentation
Jump to: navigation, search
Line 19: Line 19:
 
   use EPrints qw();
 
   use EPrints qw();
 
    
 
    
   my $session = EPrints::Session->new( 1, "demoprints" );
+
   $eprints = EPrints->new;
 +
 
 +
  # CLI
 +
  $repo = $eprints->repository( "demoprints" );
 +
 
 +
  # CGI
 +
  $repo = $eprints->current_repository;
 
    
 
    
 
   ...
 
   ...
 
 
  $session->terminate;
 
 
    
 
    
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 59: Line 63:
 
====no_check_user====
 
====no_check_user====
  
Do not check the current user/group is the same as the user/group in Systemsettings.
+
Do not check the current user/group is the same as the user/group in SystemSettings.
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 98: Line 102:
  
 
  EPrints-&gt;abort( $errmsg )
 
  EPrints-&gt;abort( $errmsg )
Print an error message and exit. If running under mod_perl then print the error as a webpage and exit.
+
This subroutine is loaded before other modules so that it may be used to report errors when initialising modules.
  
This subroutine is loaded before other modules so that it may be used to report errors when initialising modules.
+
When running under Mod_Perl this method is replaced.
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
Line 140: Line 144:
 
===current_repository===
 
===current_repository===
  
  $repo = $ep-&gt;current_repository( %options );
+
  $repo = $ep-&gt;current_repository();
Return the repository based on the current web request, or undef.
+
Returns the current repository.
  
%options as for $ep-&gt;repository(..)
+
Returns undef if there is no current repository active.
  
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>

Revision as of 13:05, 17 June 2010

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.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki


NAME

EPrints - Institutional Repository software

User Comments


SYNOPSIS

 use EPrints qw();
 
 $eprints = EPrints->new;
 
 # CLI
 $repo = $eprints->repository( "demoprints" );
 
 # CGI
 $repo = $eprints->current_repository;
 
 ...
 

User Comments


DESCRIPTION

See http://www.eprints.org/.

User Comments


Available Symbols

You can pass options to the EPrints package that effect the EPrints initialisation e.g.

 use EPrints qw( no_check_user );
 

User Comments


no_check_user

Do not check the current user/group is the same as the user/group in SystemSettings.

User Comments


Debugging Slow Processes

This module installs a signal handler that will print a stack trace if given a USR2 signal (if your system supports this signal). To print a stack trace to the error log execute:

$ kill -USR2 PID
 

Where PID is the id number of the stalled process.

A shell script will print the stack trace to the console.

User Comments


METHODS

User Comments


abort

EPrints->abort( $errmsg )

This subroutine is loaded before other modules so that it may be used to report errors when initialising modules.

When running under Mod_Perl this method is replaced.

User Comments


new

$ep = EPrints->new();

Construct a new EPrints system object.

User Comments


repository

$repo = $ep->repository( $repository_id, %options );

Return the repository with the given ID, or undef. Options are... optional.

Options noise=>1, etc.

User Comments


current_repository

$repo = $ep->current_repository();

Returns the current repository.

Returns undef if there is no current repository active.

User Comments


repository_ids

@ids = $eprints->repository_ids

Returns a list of the active repository ids.

User Comments


SEE ALSO

EPrints::Repository

User Comments


COPYRIGHT

__COPYRIGHT__

Copyright 2000-2008 University of Southampton. All Rights Reserved.

__LICENSE__

User Comments