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
API:EPrints/System
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!
<!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints 3.4 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. -->{{API}}{{Pod2Wiki}}{{API:Source|file=EPrints/System.pm|package_name=EPrints::System}}[[Category:API|SYSTEM]][[Category:API:EPrints/System|SYSTEM]]<div><!-- Edit below this comment --> <!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --> ==NAME== '''EPrints::System''' - Wrappers for system calls. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=head_description --> ==DESCRIPTION== When you call a method in this class, it is sent to the appropriate <tt>EPrints::System</tt> sub-module: EPrints::System::darwin EPrints::System::freebsd EPrints::System::linux EPrints::System::MSWin32 EPrints::System::openbsd EPrints::System::solaris By default this will be [[API:EPrints/System/linux|EPrints::System::linux]]. Which module is used is configured by the <tt>platform</tt> setting in [[API:EPrints/SystemSettings|EPrints::SystemSettings]] All file and directory names are absolute and joined by the UNIX separator character <tt>/</tt>. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=head_instance_variables --> ==INSTANCE VARIABLES== <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_$self->{uid} --> ===$self->{uid}=== The user ID of this EPrints system. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_$self->{gid} --> ===$self->{gid}=== The group ID of this EPrints system. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=head_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%; '> <span style='display:none'>User Comments</span> <!-- Edit below this comment --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=head_constructor_methods --> ===Constructor Methods=== <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_new --> ====new==== $sys = EPrints::System->new Returns 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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=head_object_methods --> ===Object Methods === <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_init --> ====init==== $sys->init Perform any platform-specific initialisation. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_chmod --> ====chmod==== $sys->chmod( $mode, @files ) Change the access control on <tt>@files</tt> listed to <tt>$mode</tt>. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_chown --> ====chown==== $sys->chown( $uid, $gid, @files ) Change the user and group on <tt>@files</tt> to <tt>$uid</tt> and <tt>$gid</tt>. <tt>$uid</tt> and <tt>$gid</tt> are as returned by [[API:EPrints/System#getpwnam|getpwnam]] (usually numeric). <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_chown_for_eprints --> ====chown_for_eprints==== $sys->chown_for_eprints( @files ) Change the user and group on <tt>@files</tt> to the current EPrints user and group. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_getgrnam --> ====getgrnam==== $gid = $sys->getgrnam( $group ) Return the system group ID of the group <tt>$group</tt>. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_getpwnam --> ====getpwnam==== ($user, $crypt, $uid, $gid ) = $sys->getpwnam( $user ) Return the login name, password crypt, UID and GID for user <tt>$user</tt>. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_current_uid --> ====current_uid==== $sys->current_uid Returns the current UID of the user running this process. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_test_uid --> ====test_uid==== $sys->test_uid Test whether the current user is the same that is configured in [[API:EPrints/SystemSettings|EPrints::SystemSettings]]. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_mkdir --> ====mkdir==== $sys->mkdir( $full_path, $perms ) Create a directory <tt>$full_path</tt> (including parent directories as necessary) set permissions described by <tt>$perms</tt>. If <tt>$perms</tt> is undefined defaults to <tt>dir_perms</tt> in [[API:EPrints/SystemSettings|EPrints::SystemSettings]]. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_exec --> ====exec==== $sys->exec( $repository, $cmd_id, %map ) Executes certain named task <tt>$cmd_id</tt> on <tt>$repository</tt>, which were once (and may be) handled by external binaries. This allows a per-platform solution to each task. E.g. unpacking a .tar.gz file. <tt>%map</tt> includes variable names and values that need to be mapped into the task command. Returns the numerical return code from the executed command. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_read_exec --> ====read_exec==== $rc = $sys->read_exec( $repo, $tmp, $cmd_id, %map ) Same as </exec> but write <tt>STDOUT</tt> and <tt>STDERR</tt> to the filename specified by <tt>$tmp</tt>. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_read_perl_script --> ====read_perl_script==== $rc = $sys->read_perl_script( $repo, $tmp, @args ) Executes Perl with arguments from <tt>@args</tt>, including the current EPrints library path. Writes <tt>STDOUT</tt> and <tt>STDERR</tt> from the script to file with name <tt>$tmp</tt>. Returns <tt>0</tt> on success. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_free_space --> ====free_space==== $sys->free_space( $dir ) Return the amount of free space (in bytes) available at <tt>$dir</tt>. <tt>$dir</tt> may contain a drive (e.g. <tt>C:</tt>) on Windows platforms. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_proc_exists --> ====proc_exists==== $bool = $sys->proc_exists( $pid ) Returns <tt>true</tt> if a process exists for ID with <tt>$pid</tt>. Returns <tt>undef</tt> if process identification is unsupported. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_get_hash_name --> ====get_hash_name==== $filename = $sys->get_hash_name Returns the last part of the filename of the hashfile for a document. (yes, it's a bad function name.) <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_write_config_file --> ====write_config_file==== $backup = write_config_file( $path, $content, [ %opts ] ) Write a config file containing <tt>$content</tt> to the file located at <tt>$path</tt>. If <tt>$content</tt> is undefined no file will be written. <tt>%opts</tt> not currently used but reserved for future use. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_quotemeta --> ====quotemeta==== $quoted = $sys->quotemeta( $path ) Quote <tt>$path</tt> so it is safe to be used in a shell call. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_capture_stderr --> ====capture_stderr==== $tmpfile = $sys->capture_stderr Captures STDERR output into a temporary file and return a file handle to it. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_restore_stderr --> ====restore_stderr==== $sys->restore_stderr( $tmpfile ) Restores <tt>STDERR</tt> after capturing. If <tt>$tmpfile</tt> is set, reset seek and sysseek to the start of this file. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_join_path --> ====join_path==== $path = $sys->join_path( @parts ) Returns <tt>@parts</tt> joined together using the current system's path separator. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_file_extension --> ====file_extension==== $ext = $sys->file_extension( $filename ) Returns the file extension of $filename including the leading <tt>.</tt> e.g. <tt>.tar.gz</tt>. Returns empty string if there is no file extension. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_sanitise --> ====sanitise==== $filepath = $sys->sanitise( $filepath ) Replaces restricted file system characters and control characters in <tt>$filepath</tt> with <tt>_</tt>. Removes path-walking elements (<tt>.</tt> and <tt>..</tt>) from the front of any path components and removes the leading <tt>/</tt>. <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=item_bin_paths --> ====bin_paths==== @paths = $sys->bin_paths Get the list of absolute directories to search for system tools (e.g. <tt>convert</tt>). <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=head_copyright --> ==COPYRIGHT== {{API:Copyright}} <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 --> <!-- Pod2Wiki= --> </div> <!-- Pod2Wiki=_postamble_ --><!-- Edit below this comment -->
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)
Templates used on this page:
Template:API
(
edit
)
Template:API:Copyright
(
edit
)
Template:API:Source
(
edit
)
Template:Pod2Wiki
(
edit
)
Template:RefLinks
(
edit
)