- NAME
- SYNOPSIS
- DESCRIPTION
- BUGS

# NAME

ActiveState::ModInfo - Queries about installed perl modules

# SYNOPSIS

     use ActiveState::ModInfo qw(list_modules find_module);

# DESCRIPTION

The following functions are provided:

$path = find_inc( $fname )
$path = find_inc( $fname, \@inc )

  Returns the full path to the given $fname, or `undef` if not found.

$path = find_module( $mod )
$path = find_module( $mod, \@inc )

  Returns the full path to the given module, or `undef` if not found.

$mod = fixup_module_case( $mod, %opts )

  Will for instance change "html::parser" into "HTML::Parser". If multiple mappings are possible return $mod unchanged. The $mod is also returned unchanged if the module can't be located.

  The following options are recognized:

  `inc` => \@list

    A list of directories to search for modules. If not provided it defaults to all the @INC.

  `prefix_only` => $bool

    If true assume $mod to just be a namespace. Will just look for matching directory names, not an actual .pm file.

$mod = fname2mod( $fname )

  Convert an fname to a module module name. The function might return `undef` if the given $fname does not represent a perl module.

%modules = list_modules( %opt )

  This function will locate all modules (.pm files) and return a list of module-name/file-location pairs.

  The following options are recognized:

  `inc` => \@list

    A list of directories to search for modules. If not provided it defaults to all the @INC entries that point inside the perl installation directory ($Config{prefix}).

  `maxdepth` => $n

    When to give up when traversing directories, i.e. how many "::"s to allow in the module name. The default is 6. A value of 0 indicate no limit.

  `allowdup` => $bool

    If true return all occurrences or any given module. If this option is false or not provided, only the first occurrence of any given module when traversing `inc` will be returned. This should also be the module that perl would pick up if @INC as the given `inc`.

  `namespace` => $ns

    Only modules in the given namespace is returned. If $ns ends with "::" only submodules of the given namespace is returned.

$fname = mod2fname( $mod )

  Convert a module name to an fname.

$fh = open_inc( $fname )
$fh = open_inc( $fname, \@inc )

  Returns an opened file handle for the given fname, or `undef` if not found. Slightly more efficient than using the standard open() function on the path returned by find_inc(), but otherwise just the same. The file is opened in read-only mode.

$fh = open_module( $mod )
$fh = open_module( $mod, \@inc )

  Returns an opened file handle for the given module, or `undef` if not found.

$vers = parse_version( $filename )

  Return the $VERSION of a module using the official ExtUtils::MakeMaker algorithm. This is a slightly modified copy of the MakeMaker function. The main difference is that it returns a real `undef` if no version number is found and do it without producing any warning.

($module, $vers) = module_version( $filename )

  Return the module name and its version number from a file.

# BUGS

none.