File::Package - test load a program module with a package of the same name
use File::Package $package = File::Package->is_package_loaded($package) $error = File::Package->load_package($package)
One very useful test of the installation of a package is whether or not the package loaded. If it did not load, the reason it did not load is helpful diagnostics.
This information is readily available when loaded at a local site. However, it the load occurs at a remote site and the load crashes Perl, the remote tester usually will not have this information readily available.
The load_package method attempts to capture any load problems by loading the package with a "require " under an eval and capturing all the "warn" and $@ messages. The error messages are returned so that they may be appropriately tested and if not as expected the actual and expected included in failure report back to the author of the package.
$package = File::Package->is_package_loaded($package)
The is_package_loaded method determines if a package vocabulary is present.
For example, if File::Basename is not loaded
==> File::Package->is_package_loaded('File::Basename') '' =head1 REQUIREMENTS
The holder of the copyright and maintainer is
Copyrighted (c) 2002 Software Diamonds
All Rights Reserved
Binding requirements are indexed with the pharse 'shall[dd]' where dd is an unique number for each header section. This conforms to standard federal government practices, 490A ("184.108.40.206" in STD490A). In accordance with the License, Software Diamonds is not liable for any requirement, binding or otherwise.
Software Diamonds permits the redistribution and use in source and binary forms, with or without modification, provided that the following conditions are met:
SOFTWARE DIAMONDS, http::www.softwarediamonds.com, PROVIDES THIS SOFTWARE 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWARE DIAMONDS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING USE OF THIS SOFTWARE, EVEN IF ADVISED OF NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE POSSIBILITY OF SUCH DAMAGE.