This is the bits which you will need to get started...
A connection to the EPrints system is represented by an instance of EPrints::Session. The session object links to
- the configuration of the repository (only one per session object, even if the system itself has multiple repositories).
- the database for the repository.
- the language to output in.
And if a CGI script then also
If you're writing your own script then you'll need to start by asking for a Session object.
#!/usr/bin/perl -w -I/opt/eprints3/perl-lib/ use EPrints; use strict; my $archive_id = $ARGV; my $session = new EPrints::Session( 1, $archive_id ); exit( 1 ) unless( defined $session ); # do your stuff $session->terminate;
The "1" passed to Session tells it that we're a normal script and not a CGI script.
The $archive_id value is taken from $ARGV which is the first parameter on the commandline. You could hard-wire the value if you wanted.
The use of "-w" to produce warnings and "use strict" to prevent sloppy code is just good Perl-practice.
This is similar to a command line script but you don't need the path to perl and the archive_id is not needed as it will work that out from the web-request.
my $session = new EPrints::Session; exit( 0 ) unless( defined $session );
# do some stuff
# Return a result to browser (usually an HTML page) $session->terminate();
Code in the EPrints Configuration Files
Such as eprint_render.pl or creating a new subroutine for render_single_value on a field.
These are always passed a $session so you don't need to create your own.
These are described in the section about plugins.