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. Methods that throw errors will throw them only the first time they're called. To start over (after, say, someone has installed Expat) construct a new App::Info::Lib::Expat object to aggregate new metadata.
CONSTRUCTOR
new
my $expat = App::Info::Lib::Expat->new(@params);
Returns an App::Info::Lib::Expat object. See App::Info for a complete description of argument parameters.
When called, new()
searches 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) -- 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. Otherwise, most of the object methods will return undef
.
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 searched for when new()
constructed the object. If Expat does not appear to be installed, then most of the other object methods will return empty values.
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. 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". See the version method for a list of possible errors.
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". See the version method for a list of possible errors.
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". See the version method for a list of possible errors.
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. Throws an error 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 for the "new" constructor.
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
attributes defined by the Perl Config module -- plus /sw/lib (for all you Fink fans) -- for one of the following files:
Throws an error if the shared object library directory cannot be found.
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.