Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
Handling Dependencies
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
This page outlines several methods to check dependancies on Bazaar package. All Dependency checking is done with a packages EPMC screen, so you will need to configure a basic EPMC screen for your plugin. =Checking Perl Library Dependencies= The following block of code checks for perl libraries, in this case Digest::HMAC_SHA1. If any of the dependancies are missing we can handle these later in render_messages. This piece of code is designed to exist in the enable method of an EPMC screen. my @prereqs = qw/ Digest::HMAC_SHA1 /; my $evalstring; foreach my $l (@prereqs) { $evalstring .= "use $l;\n"; } eval $evalstring; if (!$@) { $self->SUPER::action_enable( $skip_reload ); } This example is from the AmazonS3 plugin. =Checking Binary Dependencies= Ideally users should be able to specify the paths to binary executables in a config file and your config file should list the most "default" location. e.g. $c->{"exif_import"}->{"exif_path"} = '/usr/bin/exiftool'; The you can use the following code to check for the binary on the system. my $exiftool = $repo->get_repository->get_conf( "exif_import", "exif_path" ); if (! (-e $exiftool) ) { #binary not found } =Providing persistant helpful messages for users= A "render_messages" method can be used to provide useful messages to the user about how they need to configure their package, e.g. what dependencies they need. This example comes from the exiftool import package. sub render_messages { my( $self ) = @_; my $repo = $self->{repository}; my $xml = $repo->xml; my $frag = $xml->create_document_fragment; my $exiftool = $repo->get_repository->get_conf( "exif_import", "exif_path" ); if ( -e $exiftool ) { } else { my $msg = $xml->create_document_fragment; $msg->appendChild($xml->create_text_node('exiftool not found on your system. You need to install exiftool and/or configure this plugin with the location of exiftool.')); $self->{processor}->add_message('message',$msg); $frag->appendChild( $repo->render_message( 'error', $msg ) ); } return $frag; } [[Category:EPrints_Bazaar]]
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)