Difference between revisions of "API:EPrints"

From EPrints Documentation
Jump to: navigation, search
 
Line 8: Line 8:
 
EPrints - Institutional Repository software
 
EPrints - Institutional Repository software
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_synopsis -->
 
<!-- Pod2Wiki=head_synopsis -->
 
==SYNOPSIS==
 
==SYNOPSIS==
  use EPrints qw();
+
<source lang="perl">use EPrints qw();
 
+
 
  # don't check current user (CLI only)
+
# don't check current user (CLI only)
  use EPrints qw( no_check_user );
+
use EPrints qw( no_check_user );
 
+
 
  $eprints = EPrints-&gt;new;
+
$eprints = EPrints->new;
 
+
 
  # CLI
+
# CLI
  $repo = $eprints-&gt;repository( "demoprints" );
+
$repo = $eprints->repository( "demoprints" );
 
+
 
  # CGI
+
# CGI
  $repo = $eprints-&gt;current_repository;
+
$repo = $eprints->current_repository;
 
+
 
  if( EPrints-&gt;VERSION() gt v3.2.0 )
+
if( EPrints->VERSION() gt v3.2.0 )
  {
+
{
    ...
+
...
  }
+
}</source>
 
+
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<span style='display:none'>User Comments</span>
+
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_description -->
 
<!-- Pod2Wiki=head_description -->
 
==DESCRIPTION==
 
==DESCRIPTION==
 
See http://www.eprints.org/.
 
See http://www.eprints.org/.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_available_symbols -->
 
<!-- Pod2Wiki=head_available_symbols -->
 
===Available Symbols===
 
===Available Symbols===
 
You can pass options to the EPrints package that effect the EPrints initialisation e.g.
 
You can pass options to the EPrints package that effect the EPrints initialisation e.g.
  
  use EPrints qw( no_check_user );
+
<pre>  use EPrints qw( no_check_user );</pre>
 
+
 
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
* no_check_user
<span style='display:none'>User Comments</span>
+
: Do not check the current user/group is the same as the user/group in SystemSettings.
 +
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_debugging -->
<!-- Pod2Wiki=item_no_check_user -->
+
===Debugging===
====no_check_user====
+
To get a full stack trace on errors and warnings use {{API:PodLink|file=Carp|package_name=Carp|section=|text=Carp}}'s verbose mode. E.g. in ''perl_lib/EPrints/SystemSettings.pm'' add:
  
Do not check the current user/group is the same as the user/group in SystemSettings.
+
<pre>  use Carp 'verbose';</pre>
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_methods -->
 
<!-- Pod2Wiki=head_methods -->
 
==METHODS==
 
==METHODS==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
+
<!-- Pod2Wiki=head_VERSION -->
<span style='display:none'>User Comments</span>
+
===VERSION===
<!-- Edit below this comment -->
+
  
 +
<source lang="perl">$version = EPrints->VERSION()
  
<!-- Pod2Wiki= -->
+
</source>
</div>
+
<!-- Pod2Wiki=item_version -->
+
===version===
+
 
+
$version = EPrints-&gt;VERSION()
+
 
Returns the version of EPrints in 'v' format (this is the UNIVERSAL method).
 
Returns the version of EPrints in 'v' format (this is the UNIVERSAL method).
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_human_version -->
<!-- Pod2Wiki=item_human_version -->
+
 
===human_version===
 
===human_version===
  
EPrints-&gt;human_version()
+
<source lang="perl">EPrints->human_version()
 +
 
 +
</source>
 
Returns the EPrints version in a human-readable form.
 
Returns the EPrints version in a human-readable form.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_abort -->
<!-- Pod2Wiki=item_abort -->
+
 
===abort===
 
===abort===
  
EPrints-&gt;abort( $errmsg )
+
<source lang="perl">EPrints->abort( $errmsg )
 +
 
 +
</source>
 
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.
 
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%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_dump -->
<!-- Pod2Wiki=item_dump -->
+
 
===dump===
 
===dump===
  
EPrints-&gt;dump( $VAR1 [, $VAR2 ... ] )
+
<source lang="perl">EPrints->dump( $VAR1 [, $VAR2 ... ] )
 +
 
 +
</source>
 
Use {{API:PodLink|file=Data/Dumper|package_name=Data::Dumper|section=|text=Data::Dumper}} to dump the passed variables to STDERR.
 
Use {{API:PodLink|file=Data/Dumper|package_name=Data::Dumper|section=|text=Data::Dumper}} to dump the passed variables to STDERR.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_new -->
<!-- Pod2Wiki=item_new -->
+
 
===new===
 
===new===
  
$ep = EPrints-&gt;new();
+
<source lang="perl">$ep = EPrints->new();
 +
 
 +
</source>
 
Construct a new EPrints system object.
 
Construct a new EPrints system object.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_repository -->
<!-- Pod2Wiki=item_repository -->
+
 
===repository===
 
===repository===
  
$repo = $ep-&gt;repository( $repository_id, [%options] );
+
<source lang="perl">$repo = $ep->repository( $repository_id, [%options] );
 +
 
 +
</source>
 
Return the [[API:EPrints/Repository|EPrints::Repository]] with the given ID, or undef. Options are... optional.
 
Return the [[API:EPrints/Repository|EPrints::Repository]] with the given ID, or undef. Options are... optional.
  
 
Options noise=&gt;1, etc.
 
Options noise=&gt;1, etc.
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=head_current_repository -->
<!-- Pod2Wiki=item_current_repository -->
+
 
===current_repository===
 
===current_repository===
  
$repo = $ep-&gt;current_repository();
+
<source lang="perl">$repo = $ep->current_repository();
 +
 
 +
</source>
 
Returns the current [[API:EPrints/Repository|EPrints::Repository]]. The current  repository is determined by the apache request.
 
Returns the current [[API:EPrints/Repository|EPrints::Repository]]. The current  repository is determined by the apache request.
  
 
Returns undef if there is no current repository active.
 
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%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Edit below this comment -->
 +
 
 +
 
 +
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki=head_see_also -->
 
<!-- Pod2Wiki=head_see_also -->
 
==SEE ALSO==
 
==SEE ALSO==
 
[[API:EPrints/Repository|EPrints::Repository]]
 
[[API:EPrints/Repository|EPrints::Repository]]
  
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #cce;  padding: 0em 1em 0em 1em; font-size: 80%; '>
 
<span style='display:none'>User Comments</span>
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
 
 
<!-- Pod2Wiki=head_copyright -->
 
<!-- Pod2Wiki=head_copyright -->
 
==COPYRIGHT==
 
==COPYRIGHT==
<div style='background-color: #e8e8f; margin: 0.5em 0em 1em 0em; border: solid 1px #ccepadding: 0em 1em 0em 1em; font-size: 80%; '>
+
Copyright 2000-2011 University of Southampton.
<span style='display:none'>User Comments</span>
+
 
 +
This file is part of EPrints &lt;http://www.eprints.org/&gt;.
 +
 
 +
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 +
 
 +
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 +
 
 +
You should have received a copy of the GNU Lesser General Public License along with EPrints.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 +
 
 
<!-- Edit below this comment -->
 
<!-- Edit below this comment -->
  
  
 
<!-- Pod2Wiki= -->
 
<!-- Pod2Wiki= -->
</div>
+
<!-- Pod2Wiki=_postamble_ -->
<!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
+
<!-- Edit below this comment -->

Latest revision as of 09:56, 22 January 2013

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 - Institutional Repository software


SYNOPSIS

use EPrints qw();
 
# don't check current user (CLI only)
use EPrints qw( no_check_user );
 
$eprints = EPrints->new;
 
# CLI
$repo = $eprints->repository( "demoprints" );
 
# CGI
$repo = $eprints->current_repository;
 
if( EPrints->VERSION() gt v3.2.0 )
{
	...
}


DESCRIPTION

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


Available Symbols

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

  use EPrints qw( no_check_user );
  • no_check_user
Do not check the current user/group is the same as the user/group in SystemSettings.


Debugging

To get a full stack trace on errors and warnings use Carp's verbose mode. E.g. in perl_lib/EPrints/SystemSettings.pm add:

  use Carp 'verbose';


METHODS

VERSION

$version = EPrints->VERSION()

Returns the version of EPrints in 'v' format (this is the UNIVERSAL method).


human_version

EPrints->human_version()

Returns the EPrints version in a human-readable form.


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.


dump

EPrints->dump( $VAR1 [, $VAR2 ... ] )

Use Data::Dumper to dump the passed variables to STDERR.


new

$ep = EPrints->new();

Construct a new EPrints system object.


repository

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

Return the EPrints::Repository with the given ID, or undef. Options are... optional.

Options noise=>1, etc.


current_repository

$repo = $ep->current_repository();

Returns the current EPrints::Repository. The current repository is determined by the apache request.

Returns undef if there is no current repository active.



SEE ALSO

EPrints::Repository


COPYRIGHT

Copyright 2000-2011 University of Southampton.

This file is part of EPrints <http://www.eprints.org/>.

EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see <http://www.gnu.org/licenses/>.