NAME
App::Info::RDBMS::PostgreSQL - Information about PostgreSQL
SYNOPSIS
use App::Info::RDBMS::PostgreSQL;
my $pg = App::Info::RDBMS::PostgreSQL->new;
if ($pg->installed) {
print "App name: ", $pg->name, "\n";
print "Version: ", $pg->version, "\n";
print "Bin dir: ", $pg->bin_dir, "\n";
} else {
print "PostgreSQL is not installed. :-(\n";
}
DESCRIPTION
App::Info::RDBMS::PostgreSQL supplies information about the PostgreSQL database server installed on the local system. It implements all of the methods defined by App::Info::RDBMS. Methods that throw errors will throw them only the first time they're called. To start over (after, say, someone has installed PostgreSQL) construct a new App::Info::RDBMS::PostgreSQL object to aggregate new metadata.
CONSTRUCTOR
new
my $pg = App::Info::RDBMS::PostgreSQL->new(@params);
Returns an App::Info::RDBMS::PostgreSQL object. See App::Info for a complete description of argument parameters.
When it called, new()
searches the file system for the pg_config application. If found, pg_config will be called by the object methods below to gather the data necessary for each. If pg_config cannot be found, then PostgreSQL is assumed not to be installed, and each of the object methods will return undef
.
App::Info::RDBMS::PostgreSQL searches for pg_config along your path, as defined by File::Spec-
path>. Failing that, it searches the following directories:
- /usr/local/pgsql/bin
- /usr/local/postgres/bin
- /opt/pgsql/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/bin
- /usr/sbin
- /bin
OBJECT METHODS
installed
print "PostgreSQL is ", ($pg->installed ? '' : 'not '), "installed.\n";
Returns true if PostgreSQL is installed, and false if it is not. App::Info::RDBMS::PostgreSQL determines whether PostgreSQL is installed based on the presence or absence of the pg_config application on the file system as found when new()
constructed the object. If PostgreSQL does not appear to be installed, then all of the other object methods will return empty values.
name
my $name = $pg->name;
Returns the name of the application. App::Info::RDBMS::PostgreSQL parses the name from the system call `pg_config --version`
. Throws an error if PostgreSQL is installed but the version number or name could not be parsed.
version
my $version = $pg->version;
Returns the PostgreSQL version number. App::Info::RDBMS::PostgreSQL parses the version number from the system call `pg_config --version`
. See the name method for a list of possible errors.
major version
my $major_version = $pg->major_version;
Returns the PostgreSQL major version number. App::Info::RDBMS::PostgreSQL parses the major version number from the system call `pg_config --version`
. For example, version()
returns "7.1.2", then this method returns "7". See the name method for a list of possible errors.
minor version
my $minor_version = $pg->minor_version;
Returns the PostgreSQL minor version number. App::Info::RDBMS::PostgreSQL parses the minor version number from the system call `pg_config --version`
. For example, if version()
returns "7.1.2", then this method returns "2". See the name method for a list of possible errors.
patch version
my $patch_version = $pg->patch_version;
Returns the PostgreSQL patch version number. App::Info::RDBMS::PostgreSQL parses the patch version number from the system call `pg_config --version`
. For example, if version()
returns "7.1.2", then this method returns "1". See the name method for a list of possible errors.
bin_dir
my $bin_dir = $pg->bin_dir;
Returns the PostgreSQL binary directory path. App::Info::RDBMS::PostgreSQL gathers the path from the system call `pg_config --bindir`
. Throws an error if the binary directory path cannot be determined.
inc_dir
my $inc_dir = $pg->inc_dir;
Returns the PostgreSQL include directory path. App::Info::RDBMS::PostgreSQL gathers the path from the system call `pg_config --includedir`
. Throws an error if the include directory path cannot be determined.
lib_dir
my $lib_dir = $pg->lib_dir;
Returns the PostgreSQL library directory path. App::Info::RDBMS::PostgreSQL gathers the path from the system call `pg_config --libdir`
. Throws an error if the library directory path cannot be determined.
so_lib_dir
my $so_lib_dir = $pg->so_lib_dir;
Returns the PostgreSQL shared object library directory path. App::Info::RDBMS::PostgreSQL gathers the path from the system call `pg_config --pkglibdir`
. Throws an error if the shared object library directory path cannot be determined.
home_url
my $home_url = $pg->home_url;
Returns the PostgreSQL home page URL.
download_url
my $download_url = $pg->download_url;
Returns the PostgreSQL download URL.
BUGS
Feel free to drop me a line if you discover any bugs. Patches welcome.
AUTHOR
David Wheeler <david@wheeler.net> based on code by Sam Tregar <sam@tregar.com>.
SEE ALSO
App::Info, App::Info::RDBMS, DBD::Pg
COPYRIGHT AND LICENSE
Copyright (c) 2002, David Wheeler. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.