The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Module::Find - Search @INC for libraries without loading them

SYNOPSIS

        use Module::Find qw(find_module);

        # find the first CGI.pm
        my $location  = find_module( "CGI" );

        # find all of them
        my @loactions = find_module( "CGI" );

        # find module directories
        my @directories = find_module_dirs( "Test" );

        # find modules under a namespace
        my @modules = find_modules_under( "Test" );

DESCRIPTION

Module::Find goes through the directories in @INC and finds the occurances of the named module or library. It can return the first location it finds or all the location it finds. It does not attempt to load the modules.

Functions

find_module( MODULE [, ARRAY] )

Given MODULE, return a list of all of its installed locations under the directories in ARRAY (or @INC by default). In scalar context it returns the first installed location, which should be the same one that perl finds first.

find_module_dirs( NAMESPACE [, ARRAY] )

Given NAMESPACE (not necessarily a complete module name), find all directories under those in ARRAY (or @INC by default ) that contain that namespace. It returns a list of directory names.

find_modules_under( NAMESPACE [, ARRAY] )

Like find_module_dirs, but returns all of the modules under the same directories. It returns a list of module names (i.e. Foo::Bar).

For instance, if I wanted to find all the modules under the Module::Release namespace (so I could load them all), I could:

        foreach my $module ( find_modules_under( "Module::Release" ) )
                {
                require $module;
                }

SOURCE AVAILABILITY

This source is part of a SourceForge project which always has the latest sources in CVS, as well as all of the previous releases.

        http://sourceforge.net/projects/brian-d-foy/

If, for some reason, I disappear from the world, one of the other members of the project can shepherd this module appropriately.

AUTHORS

brian d foy, <bdfoy@cpan.org>

COPYRIGHT

Copyright (c) 2004 brian d foy. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.