NAME
App::Info::Lib::Expat - Information about the Expat XML parser
SYNOPSIS
use App::Info::Lib::Expat;
my $expat = App::Info::Lib::Expat->new;
if ($expat->installed) {
print "App name: ", $expat->name, "\n";
print "Version: ", $expat->version, "\n";
print "Bin dir: ", $expat->bin_dir, "\n";
} else {
print "Expat is not installed. :-(\n";
}
DESCRIPTION
App::Info::Lib::Expat supplies information about the Expat XML parser installed on the local system. It implements all of the methods defined by App::Info::Lib.
When it loads, App::Info::Lib::Expat searches all of the paths in the libsdirs
and loclibpth
-- as defined by the Perl Config module -- plus /sw/lib (in support of all you Fink users out there) for one of the following files:
- libexpat.so
- libexpat.so.0
- libexpat.so.0.0.1
- libexpat.dylib
- libexpat.0.dylib
- libexpat.0.0.1.dylib
- libexpat.a
- libexpat.la
If any of these files is found, then Expat is assumed to be installed.
CONSTRUCTOR
new
my $expat = App::Info::Lib::Expat->new;
Returns an App::Info::Lib::Expat object. Since App::Info::Lib::Expat 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 "Expat is ", ($expat->installed ? '' : 'not '),
"installed.\n";
Returns true if Expat is installed, and false if it is not. App::Info::Lib::Expat determines whether Expat is installed based on the presence or absence on the file system of one of the files described in the "Description".
name
my $name = $expat->name;
Returns the name of the application. In this case, name()
simply returns the string "Expat".
version
Returns the full version number for Expat. App::Info::Lib::Expat parses the version number from the expat.h file, if it exists. Returns undef if Expat is not installed. Emits a warning if Expat is installed but expat.h could not be found or the version number could not be parsed.
major_version
my $major_version = $expat->major_version;
Returns the Expat major version number. App::Info::Lib::Expat parses the version number from the expat.h file, if it exists. For example, if version()
returns "1.95.2", then this method returns "1". Returns undef if Expat is not installed. Emits a warning if Expat is installed but expat.h could not be found or the version number could not be parsed.
minor_version
my $minor_version = $expat->minor_version;
Returns the Expat minor version number. App::Info::Lib::Expat parses the version number from the expat.h file, if it exists. For example, if version()
returns "1.95.2", then this method returns "95". Returns undef if Expat is not installed. Emits a warning if Expat is installed but expat.h could not be found or the version number could not be parsed.
patch_version
my $patch_version = $expat->patch_version;
Returns the Expat patch version number. App::Info::Lib::Expat parses the version number from the expat.h file, if it exists. For example, if version()
returns "1.95.2", then this method returns "2". Returns undef if Expat is not installed. Emits a warning if Expat is installed but expat.h could not be found or the version number could not be parsed.
bin_dir
my $bin_dir = $expat->bin_dir;
Since Expat includes no binaries, this method always returns false.
inc_dir
my $inc_dir = $expat->inc_dir;
Returns the directory path in which the file expat.h was found. Returns undef if Expat is not installed, or if expat.h could not be found. App::Info::Lib::Expat searches for expat.h in the following directories:
lib_dir
my $lib_dir = $expat->lib_dir;
Returns the directory path in which a Expat library was found. The files and paths searched are as described in the "DESCRIPTION".
so_lib_dir
my $so_lib_dir = $expat->so_lib_dir;
Returns the directory path in which a Expat shared object library was found. It searches all of the paths in the libsdirs
and loclibpth
-- as defined by the Perl Config module -- plus /sw/lib (for all you Fink fans) for one of the following files:
home_url
my $home_url = $expat->home_url;
Returns the libexpat home page URL.
download_url
my $download_url = $expat->download_url;
Returns the libexpat 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. And if anyone knows how to get the version numbers, let me know!
The format of the version number seems to have changed recently (1.95.1-2), and now I don't know where to grab it from. Patches welcome.
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> that Sam, in turn, borrowed from Clark Cooper's XML::Parser module.
SEE ALSO
App::Info, App::Info::Lib, XML::Parser
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.