|
NAMEApp::Info::RDBMS::PostgreSQL - Information about PostgreSQLSYNOPSISuse 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"; } DESCRIPTIONApp::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 trigger events will trigger them only the first time they're called (See App::Info for documentation on handling events). To start over (after, say, someone has installed PostgreSQL) construct a new App::Info::RDBMS::PostgreSQL object to aggregate new meta data.Some of the methods trigger the same events. This is due to cross-calling of shared subroutines. However, any one event should be triggered no more than once. For example, although the info event "Executing `pg_config --version`" is documented for the methods "name()", "version()", "major_version()", "minor_version()", and "patch_version()", rest assured that it will only be triggered once, by whichever of those four methods is called first. INTERFACEConstructornewmy $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 an executable named for the list returned by "search_exe_names()", usually pg_config, in the list of directories returned by "search_bin_dirs()". 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". "new()" also takes a number of optional parameters in addition to those documented for App::Info. These parameters allow you to specify alternate names for PostgreSQL executables (other than pg_config, which you specify via the "search_exe_names" parameter). These parameters are:
Events:
Class Methodkey_namemy $key_name = App::Info::RDBMS::PostgreSQL->key_name; Returns the unique key name that describes this class. The value returned is the string "PostgreSQL". Object Methodsinstalledprint "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`". Events:
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`". Events:
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, if "version()" returns "7.1.2", then this method returns "7". Events:
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". Events:
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". Events:
executable my $exe = $pg->executable; Returns the full path to the PostgreSQL server executable, which is named postgres. This method does not use the executable names returned by "search_exe_names()"; those executable names are used to search for pg_config only (in "new()"). When it called, "executable()" checks for an executable named postgres in the directory returned by "bin_dir()". Note that "executable()" is simply an alias for "postgres()". Events:
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`". Events:
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`". Events:
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`". Events:
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`". Events:
configure options my $configure = $pg->configure; Returns the options with which the PostgreSQL server was configured. App::Info::RDBMS::PostgreSQL gathers the configure data from the system call "`pg_config --configure`". Events:
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. search_exe_names my @search_exe_names = $app->search_exe_names; Returns a list of possible names for pg_config executable. By default, only pg_config is returned (or pg_config.exe on Win32). Note that this method is not used to search for the PostgreSQL server executable, only pg_config. search_bin_dirs my @search_bin_dirs = $app->search_bin_dirs; Returns a list of possible directories in which to search an executable. Used by the "new()" constructor to find an executable to execute and collect application info. The found directory will also be returned by the "bin_dir" method. The list of directories by default consists of the path as defined by "File::Spec->path", as well as the following directories:
Other Executable MethodsThese methods function just like the "executable()" method, except that they return different executables. PostgreSQL comes with a fair number of them; we provide these methods to provide a path to a subset of them. Each method, when called, checks for an executable in the directory returned by "bin_dir()". The name of the executable must be one of the names returned by the corresponding "search_*_names" method.The available executable methods are:
And the corresponding search names methods are:
Events:
SUPPORTThis module is stored in an open GitHub repository <http://github.com/theory/app-info/>. Feel free to fork and contribute!Please file bug reports via GitHub Issues <http://github.com/theory/app-info/issues/> or by sending mail to bug-App-Info@rt.cpan.org <mailto:bug-App-Info@rt.cpan.org>. AUTHORDavid E. Wheeler <david@justatheory.com> based on code by Sam Tregar <sam@tregar.com>.SEE ALSOApp::Info documents the event handling interface.App::Info::RDBMS is the App::Info::RDBMS::PostgreSQL parent class. DBD::Pg is the DBI driver for connecting to PostgreSQL databases. <http://www.postgresql.org/> is the PostgreSQL home page. COPYRIGHT AND LICENSECopyright (c) 2002-2011, David E. Wheeler. Some Rights Reserved.This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |