NAME
App::Info::Lib::Iconv - Information about libiconv
SYNOPSIS
use App::Info::Lib::Iconv;
my $iconv = App::Info::Lib::Iconv->new;
if ($iconv->installed) {
print "App name: ", $iconv->name, "\n";
print "Version: ", $iconv->version, "\n";
print "Bin dir: ", $iconv->bin_dir, "\n";
} else {
print "libiconv is not installed. :-(\n";
}
DESCRIPTION
App::Info::Lib::Iconv supplies information about the libiconv library installed on the local system. It implements all of the methods defined by App::Info::Lib.
When it loads, App::Info::Lib::Iconv searches the file system for the iconv application. If iconv is found, libiconv will be assumed to be installed.
App::Info::Lib::Iconv searches for iconv along your path, as defined by File::Spec-
path>. Failing that, it searches the following directories:
CONSTRUCTOR
new
my $iconv = App::Info::Lib::Iconv->new;
Returns an App::Info::Lib::Iconv object. Since App::Info::Lib::Iconv is implemented as a singleton class, the same object will be returned every time. This ensures that only the minimum number of system calls are made to gather the data necessary for the object methods.
OBJECT METHODS
installed
print "libiconv is ", ($iconv->installed ? '' : 'not '),
"installed.\n";
Returns true if libiconv is installed, and false if it is not. App::Info::Lib::Iconv determines whether libiconv is installed based on the presence or absence of the iconv application on the file system.
name
my $name = $iconv->name;
Returns the name of the application. In this case, name()
simply returns the string "libiconv".
version
my $version = $iconv->version;
Returns the full version number for libiconv. App::Info::Lib::Iconv parses the version number from the iconv.h file, if it exists. Returns undef
if Iconv is not installed. Emits a warning if Iconv is installed but iconv.h could not be found or the version number could not be parsed.
major_version
my $major_version = $iconv->major_version;
Returns the Iconv major version number. App::Info::Lib::Iconv parses the version number from the iconv.h file, if it exists. For example, if version()
returns "1.95.2", then this method returns "1". Returns undef
if Iconv is not installed. Emits a warning if Iconv is installed but iconv.h could not be found or the version number could not be parsed.
minor_version
my $minor_version = $iconv->minor_version;
Returns the Iconv minor version number. App::Info::Lib::Iconv parses the version number from the iconv.h file, if it exists. For example, if version()
returns "1.95.2", then this method returns "95". Returns undef
if Iconv is not installed. Emits a warning if Iconv is installed but iconv.h could not be found or the version number could not be parsed.
patch_version
my $patch_version = $iconv->patch_version;
Libiconv has no patch number in its version number, so this method will always return false.
bin_dir
my $bin_dir = $iconv->bin_dir;
Returns the path of the directory in which the iconv application was found. Returns undef
if libiconv is not installed.
inc_dir
my $inc_dir = $iconv->inc_dir;
Returns the directory path in which the file iconv.h was found. Returns undef
if libiconv is not installed, or if iconv.h could not be found. App::Info::Lib::Iconv searches for iconv.h in the following directories:
lib_dir
my $lib_dir = $iconv->lib_dir;
Returns the directory path in which a libiconv library was found. Returns undef
if libiconv is not installed, or if no libiconv library could be found. App::Info::Lib::Iconv searches for these files:
- libiconv.so
- libiconv.so.0
- libiconv.so.0.0.1
- libiconv.dylib
- libiconv.2.dylib
- libiconv.2.0.4.dylib
- libiconv.a
- libiconv.la
...in these directories:
so_lib_dir
my $so_lib_dir = $iconv->so_lib_dir;
Returns the directory path in which a libiconv shared object library was found. Returns undef
if libiconv is not installed, or if no libiconv shared object library could be found. App::Info::Lib::Iconv searches for these files:
...in these directories:
home_url
my $home_url = $iconv->home_url;
Returns the libiconv home page URL.
download_url
my $download_url = $iconv->download_url;
Returns the libiconv download URL.
KNOWN ISSUES
This is a pretty simple class. It's possible that there are more directories that ought to be searched for libraries and includes.
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::Lib, Text::Iconv
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.