|
App::Info::Lib::Iconv - Information about libiconv |
App::Info::Lib::Iconv - Information about libiconv
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";
}
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. 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 libiconv) construct a new App::Info::Lib::Iconv object to aggregate new metadata.
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 ``Searching for 'iconv.h''' is
documented for the methods version(), major_version(), and
minor_version(), rest assured that it will only be triggered once, by
whichever of those four methods is called first.
my $iconv = App::Info::Lib::Iconv->new(@params);
Returns an App::Info::Lib::Iconv object. See App::Info for a complete description of argument parameters.
When called, new() searches the file system for the iconv executable. If
iconv is found, libiconv will be assumed to be installed. Otherwise, most
of the object methods will return undef.
App::Info::Lib::Iconv searches for iconv along your path, as defined by
File::Spec->path. Failing that, it searches the following directories:
Events:
my $key_name = App::Info::Lib::Iconv->key_name;
Returns the unique key name that describes this class. The value returned is the string ``libiconv''.
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, as found when new()
constructed the object. If libiconv does not appear to be installed, then most
of the other object methods will return empty values.
my $name = $iconv->name;
Returns the name of the application. In this case, name() simply returns
the string ``libiconv''.
my $version = $iconv->version;
Returns the full version number for libiconv. App::Info::Lib::Iconv attempts to parse the version number from the iconv.h file, if it exists.
Events:
Searching for include directory
Cannot find 'iconv.h'
Cannot parse version number from file 'iconv.h'
Enter a valid libiconv version number
my $major_version = $iconv->major_version;
Returns the libiconv major version number. App::Info::Lib::Iconv attempts to
parse the version number from the iconv.h file, if it exists. For example,
if version() returns ``1.7'', then this method returns ``1''.
Events:
Searching for include directory
Cannot find 'iconv.h'
Cannot parse version number from file 'iconv.h'
Enter a valid libiconv version number
my $minor_version = $iconv->minor_version;
Returns the libiconv minor version number. App::Info::Lib::Iconv attempts to
parse the version number from the iconv.h file, if it exists. For example,
if version() returns ``1.7'', then this method returns ``7''.
Events:
Searching for include directory
Cannot find 'iconv.h'
Cannot parse version number from file 'iconv.h'
Enter a valid libiconv version number
my $patch_version = $iconv->patch_version;
Since libiconv has no patch number in its version number, this method will always return false.
my $bin_dir = $iconv->bin_dir;
Returns the path of the directory in which the iconv application was found
when the object was constructed by new().
Events:
my $inc_dir = $iconv->inc_dir;
Returns the directory path in which the file iconv.h was found. App::Info::Lib::Iconv searches for iconv.h in the following directories:
Events:
my $lib_dir = $iconv->lib_dir;
Returns the directory path in which a libiconv library was found. App::Info::Lib::Iconv searches for these files:
...in these directories:
Events:
my $so_lib_dir = $iconv->so_lib_dir;
Returns the directory path in which a libiconv shared object library was found. App::Info::Lib::Iconv searches for these files:
...in these directories:
<Events:>
my $home_url = $iconv->home_url;
Returns the libiconv home page URL.
my $download_url = $iconv->download_url;
Returns the libiconv download URL.
This is a pretty simple class. It's possible that there are more directories that ought to be searched for libraries and includes.
Improve this class by borrowing code from Matt Seargent's AxKit Makefil.PL.
Report all bugs via the CPAN Request Tracker at http://rt.cpan.org/NoAuth/Bugs.html.
David Wheeler <david@wheeler.net> based on code by Sam Tregar <sam@tregar.com>.
App::Info, App::Info::Lib, Text::Iconv
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.
|
App::Info::Lib::Iconv - Information about libiconv |