|
App::Info::Lib::Expat - Information about the Expat XML parser |
App::Info::Lib::Expat - Information about the Expat XML parser
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";
}
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 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 Expat) construct a new App::Info::Lib::Expat 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 'expat.h''' is
documented for the methods 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.
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:
If any of these files is found, then Expat is assumed to be installed.
Otherwise, most of the object methods will return undef.
Events:
my $key_name = App::Info::Lib::Expat->key_name;
Returns the unique key name that describes this class. The value returned is the string ``Expat''.
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.
my $name = $expat->name;
Returns the name of the application. In this case, name() simply returns
the string ``Expat''.
Returns the full version number for Expat. App::Info::Lib::Expat attempts to parse the version number from the expat.h file, if it exists.
Events:
Searching for include directory
Cannot find 'expat.h'
Failed to parse version from 'expat.h'
Enter a valid Expat version number
my $major_version = $expat->major_version;
Returns the Expat major version number. App::Info::Lib::Expat attempts to
parse the version number from the expat.h file, if it exists. For example,
if version() returns ``1.95.2'', then this method returns ``1''.
Events:
Searching for include directory
Cannot find 'expat.h'
Failed to parse version from 'expat.h'
Enter a valid Expat major version number
my $minor_version = $expat->minor_version;
Returns the Expat minor version number. App::Info::Lib::Expat attempst to
parse the version number from the expat.h file, if it exists. For example,
if version() returns ``1.95.2'', then this method returns ``95''.
Events:
Searching for include directory
Cannot find 'expat.h'
Failed to parse version from 'expat.h'
Enter a valid Expat minor version number
my $patch_version = $expat->patch_version;
Returns the Expat patch version number. App::Info::Lib::Expat attempst to
parse the version number from the expat.h file, if it exists. For example,
version() returns ``1.95.2'', then this method returns ``2''.
Events:
Searching for include directory
Cannot find 'expat.h'
Failed to parse version from 'expat.h'
Enter a valid Expat patch version number
my $bin_dir = $expat->bin_dir;
Since Expat includes no binaries, this method always returns false.
my $inc_dir = $expat->inc_dir;
Returns the directory path in which the file expat.h was found. App::Info::Lib::Expat searches for expat.h in the following directories:
Events:
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, as are the events.
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:
Events:
my $home_url = $expat->home_url;
Returns the libexpat home page URL.
my $download_url = $expat->download_url;
Returns the libexpat 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. 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 find the version number. Patches welcome.
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> that Sam, in turn, borrowed from Clark Cooper's XML::Parser module.
App::Info documents the event handling interface.
App::Info::Lib is the App::Info::Lib::Expat parent class.
XML::Parser uses Expat to parse XML.
Config provides Perl configure-time information used by App::Info::Lib::Expat to locate Expat libraries and files.
http://expat.sourceforge.net/ is the Expat home page.
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::Expat - Information about the Expat XML parser |