NAME

App::Info::RDBMS::SQLite - Information about SQLite

SYNOPSIS

use App::Info::RDBMS::SQLite;

my $sqlite = App::Info::RDBMS::SQLite->new;

if ($sqlite->installed) {
    print "App name: ", $sqlite->name, "\n";
    print "Version:  ", $sqlite->version, "\n";
    print "Bin dir:  ", $sqlite->bin_dir, "\n";
} else {
    print "SQLite is not installed. :-(\n";
}

DESCRIPTION

App::Info::RDBMS::SQLite supplies information about the SQLite application 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 SQLite) construct a new App::Info::RDBMS::SQLite 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.

INTERFACE

Constructor

new

my $sqlite = App::Info::RDBMS::SQLite->new(@params);

Returns an App::Info::RDBMS::SQLite object. See App::Info for a complete description of argument parameters.

When it called, new() searches the directories returned by search_bin_dirs for an executable with a name returned by search_exe_names. If found, it will be called by the object methods below to gather the data necessary for each. If it cannot be found, then new() will attempt to load DBD::SQLite or DBD::SQLite2. These DBI drivers have SQLite embedded in them but do not install the application. If these fail, then SQLite is assumed not to be installed, and each of the object methods will return undef.

Events:

info

Looking for SQLite.

confirm

Path to SQLite executable?

unknown

Path to SQLite executable?

Class Method

key_name

my $key_name = App::Info::RDBMS::SQLite->key_name;

Returns the unique key name that describes this class. The value returned is the string "SQLite".

Object Methods

installed

print "SQLite is ", ($sqlite->installed ? '' : 'not '), "installed.\n";

Returns true if SQLite is installed, and false if it is not.

App::Info::RDBMS::SQLite determines whether SQLite is installed based on the presence or absence of the sqlite3 or sqlite application on the file system as found when new() constructed the object. If SQLite does not appear to be installed, then all of the other object methods will return empty values.

name

my $name = $sqlite->name;

Returns the name of the application. App::Info::RDBMS::SQLite simply returns the value returned by key_name if SQLite is installed, and undef if it is not installed.

version

my $version = $sqlite->version;

Returns the SQLite version number. App::Info::RDBMS::SQLite parses the version number from the system call `sqlite -version` or retrieves it from DBD::SQLite.

Events:

info

Executing `sqlite -version`

error

Failed to find SQLite version with `sqlite -version`

Failed to retrieve SQLite version from DBD::SQLite

Unable to parse name from string

Unable to parse version from string

Failed to parse SQLite version parts from string

unknown

Enter a valid SQLite version number

major version

my $major_version = $sqlite->major_version;

Returns the SQLite major version number. App::Info::RDBMS::SQLite parses the version number from the system call `sqlite -version` or retrieves it from DBD::SQLite. For example, if version() returns "3.0.8", then this method returns "3".

Events:

info

Executing `sqlite -version`

error

Failed to find SQLite version with `sqlite -version`

Failed to retrieve SQLite version from DBD::SQLite

Unable to parse name from string

Unable to parse version from string

Failed to parse SQLite version parts from string

unknown

Enter a valid SQLite version number

minor version

my $minor_version = $sqlite->minor_version;

Returns the SQLite minor version number. App::Info::RDBMS::SQLite parses the version number from the system call `sqlite -version` or retrieves it from DBD::SQLite. For example, if version() returns "3.0.8", then this method returns "0".

Events:

info

Executing `sqlite -version`

error

Failed to find SQLite version with `sqlite -version`

Failed to retrieve SQLite version from DBD::SQLite

Unable to parse name from string

Unable to parse version from string

Failed to parse SQLite version parts from string

unknown

Enter a valid SQLite version number

patch version

my $patch_version = $sqlite->patch_version;

Returns the SQLite patch version number. App::Info::RDBMS::SQLite parses the version number from the system call `sqlite -version` or retrieves it from DBD::SQLite. For example, if version() returns "3.0.8", then this method returns "8".

Events:

info

Executing `sqlite -version`

error

Failed to find SQLite version with `sqlite -version`

Failed to retrieve SQLite version from DBD::SQLite

Unable to parse name from string

Unable to parse version from string

Failed to parse SQLite version parts from string

unknown

Enter a valid SQLite version number

executable

my $executable = $sqlite->executable;

Returns the path to the SQLite executable, usually sqlite3 or sqlite, which will be defined by one of the names returned bysearch_exe_names(). The executable is searched for in new(), so there are no events for this method.

bin_dir

my $bin_dir = $sqlite->bin_dir;

Returns the SQLite binary directory path. App::Info::RDBMS::SQLite simply retrieves it as the directory part of the path to the SQLite executable.

lib_dir

my $lib_dir = $expat->lib_dir;

Returns the directory path in which an SQLite library was found. The directory path will be one of the values returned by search_lib_dirs(), where a file with a name as returned by search_lib_names() was found. No search is performed if SQLite is not installed or if only DBD::SQLite is installed.

Events:

info

Searching for shared object library directory

error

Cannot find shared object library directory

unknown

Enter a valid Expat shared object library directory

so_lib_dir

my $so_lib_dir = $expat->so_lib_dir;

Returns the directory path in which an SQLite shared object library was found. The directory path will be one of the values returned by search_lib_dirs(), where a file with a name as returned by search_so_lib_names() was found. No search is performed if SQLite is not installed or if only DBD::SQLite is installed.

Events:

info

Searching for shared object library directory

error

Cannot find shared object library directory

unknown

Enter a valid Expat shared object library directory

inc_dir

my $inc_dir = $sqlite->inc_dir;

Returns the directory path in which an SQLite include file was found. The directory path will be one of the values returned by search_inc_dirs(), where a file with a name as returned by search_inc_names() was found. No search is performed if SQLite is not installed or if only DBD::SQLite is installed.

Events:

info

Searching for include directory

error

Cannot find include directory

unknown

Enter a valid SQLite include directory

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 = $sqlite->search_exe_names;

Returns a list of possible names for the SQLite executable. The names are sqlite3 and sqlite by default (sqlite3.exe and sqlite.exe on Win32).

search_bin_dirs

my @search_bin_dirs = $sqlite->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.

search_lib_names

my @seach_lib_names = $self->search_lib_nams

Returns a list of possible names for library files. Used by lib_dir() to search for library files. By default, the list is:

libsqlite3.a
libsqlite3.la
libsqlite3.so
libsqlite3.so.0
libsqlite3.so.0.0.1
libsqlite3.dylib
libsqlite3.0.dylib
libsqlite3.0.0.1.dylib
libsqlite.a
libsqlite.la
libsqlite.so
libsqlite.so.0
libsqlite.so.0.0.1
libsqlite.dylib
libsqlite.0.dylib
libsqlite.0.0.1.dylib

search_so_lib_names

my @seach_so_lib_names = $self->search_so_lib_nams

Returns a list of possible names for shared object library files. Used by so_lib_dir() to search for library files. By default, the list is:

libsqlite3.so
libsqlite3.so.0
libsqlite3.so.0.0.1
libsqlite3.dylib
libsqlite3.0.dylib
libsqlite3.0.0.1.dylib
libsqlite.so
libsqlite.so.0
libsqlite.so.0.0.1
libsqlite.dylib
libsqlite.0.dylib
libsqlite.0.0.1.dylib

search_lib_dirs

my @search_lib_dirs = $sqlite->search_lib_dirs;

Returns a list of possible directories in which to search for libraries. By default, it returns all of the paths in the libsdirs and loclibpth attributes defined by the Perl Config module -- plus /sw/lib (in support of all you Fink users out there).

search_inc_names

my @search_inc_names = $sqlite->search_inc_names;

Returns a list of include file names to search for. Used by inc_dir() to search for an include file. By default, the names are sqlite3.h and sqlite.h.

search_inc_dirs

my @search_inc_dirs = $sqlite->search_inc_dirs;

Returns a list of possible directories in which to search for include files. Used by inc_dir() to search for an include file. By default, the directories are:

/usr/local/include
/usr/include
/sw/include

SUPPORT

This module is stored in an open GitHub repository. Feel free to fork and contribute!

Please file bug reports via GitHub Issues or by sending mail to bug-App-Info@rt.cpan.org.

AUTHOR

David E. Wheeler <david@justatheory.com>

SEE ALSO

App::Info documents the event handling interface.

App::Info::RDBMS is the App::Info::RDBMS parent class from which App::Info::RDBMS::SQLite inherits.

DBD::SQLite is the DBI driver for connecting to SQLite databases.

http://www.sqlite.org/ is the SQLite home page.

COPYRIGHT AND LICENSE

Copyright (c) 2004-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.