NAME
UR::Context::Process - Implements a generic interface to the current application.
SYNOPSIS
$name = UR::Context::Process->base_name;
$name = UR::Context::Process->prog_name;
UR::Context::Process->prog_name($name);
$name = UR::Context::Process->pkg_name;
UR::Context::Process->pkg_name($name);
$name = UR::Context::Process->title;
UR::Context::Process->title($name);
$version = UR::Context::Process->version;
UR::Context::Process->version($version);
$author = UR::Context::Process->author;
UR::Context::Process->author($author);
$author_email = UR::Context::Process->author_email;
UR::Context::Process->author_email($author_email);
$support_email = UR::Context::Process->support_email;
UR::Context::Process->support_email($support_email);
$login = UR::Context::Process->real_user_name;
DESCRIPTION
This module provides methods to set and retrieve various names associated with the program and the program version number.
METHODS
These methods provide the accessor and set methods for various names associated with an application.
- get_current
-
$ctx = UR::Context::Process->get_current();
This is the context which represents the current process.
Also available as UR::Context->get_process();
- has_changes()
-
$bool = UR::Context::Process->has_changes();
Returns true if the current process has changes which might be committed back to the underlying context.
- _create_for_current_process
-
$ctx = UR::Context::Process->_create_for_current_process(@PARAMS)
This is only used internally by UR. It materializes a new object to represent a real process somewhere.
TODO: Remove the exception from create(), and allow other processes to be created explicitly w/ the appropriate characteristics.
- base_name
-
$name = UR::Context::Process->base_name;
This is
basename($0, '.pl'))
.
- prog_name
-
$name = UR::Context::Process->prog_name; UR::Context::Process->prog_name($name);
This method is used to access and set the name of the program name.
This name is used in the output of the
version
andusage
subroutines (see "version" and "usage"). If given an argument, this method sets the program name and returns the new name orundef
if unsuccessful.It defaults to
basename
if unspecified.
- pkg_name
-
$name = UR::Context::Process->pkg_name; UR::Context::Process->pkg_name($name);
This method is used to access and set the GNU-standard package name for the package to which this program belongs. This is does NOT refer-to a Perl package. It allows a set of specific programs to be grouped together under a common name, which is used in standard message output, and is used in the output of the
version
subroutine (see "version" output.If given an argument, this method sets the package name and returns the the new name or
undef
if unsuccessful. Without an argument, the current package name is returned.It defaults to
prog_name
when unspecified, which in turn defaults tobase_name
, which in turn defaults tobasename($0)
.
- title
-
$name = UR::Context::Process->title; UR::Context::Process->title($name);
This gets and sets the "friendly name" for an application. It is often mixed-case, with spaces, and is used in autogenerated documentation, and sometimes as a header in generic GUI components. Without an argument, it returns the current title. If an argument is specified, this method sets the application title and returns the new title or
undef
if unsuccessful.It defaults to
pkg_name
when otherwise unspecified, which in turn defaults toprog_name
when unspecified, which in turn defaults tobase_name
when unspecified, which defaults tobasename($0)
when unspecified.
- version
-
$version = UR::Context::Process->version; UR::Context::Process->version($version);
This method is used to access and set the package version. This version is used in the output of the
print_version
method (see "print_version" in App::Getopt). If given an argument, this method sets the package version and returns the version orundef
if unsuccessful. Without an argument, the current package version is returned.This message defaults to
$main::VERSION
if not set. Note that$main::VERSION
may beundef
.
-
$author = UR::Context::Process->author; UR::Context::Process->author($author);
This method is used to access and set the package author. If given an argument, this method sets the package author and returns the author or
undef
if unsuccessful. Without an argument, the current author is returned.
-
$author_email = UR::Context::Process->author_email; UR::Context::Process->author_email($author_email);
This method is used to access and set the package author's email address. This information is used in the output of the
usage
method (see "usage" in App::Getopt). If given an argument, this method sets the package author's email address and returns email address orundef
if unsuccessful. Without an argument, the current email address is returned.
- support_email
-
$support_email = UR::Context::Process->support_email; UR::Context::Process->support_email($support_email);
This method is used to access and set the email address to which the user should go for support. This information is used in the output of the
usage
method (see "usage" in App::Getopt). If given an argument, this method sets the support email address and returns that email address orundef
if unsuccessful. Without an argument, the current email address is returned.
- real_user_name
-
$login = UR::Context::Process->real_user_name;
This method is used to get the login name of the effective user id of the running script.
- fork $pid = UR::Context::Process->fork;
-
Safe fork() wrapper.
Handles properly disconnecting database handles if necessary so that data sources in children are still valid. Also ensures that the active UR::Context::process has the child's PID recorded within.
- effective_user_name
-
$login = UR::Context::Process->effective_user_name;
This method is used to get the login name of the effective user id of the running script.
- original_program_path
-
$path = UR::Context::Process->original_program_path;
This method is used to (try to) get the original program path of the running script. This will not change even if the current working directory is changed. (In truth it will find the path at the time UR::Context::Process was used. So, a chdir before that happens will cause incorrect results; in that case, undef will be returned.