NAME

HTML::Perlinfo::Modules - Display a lot of module information in HTML format

SYNOPSIS

use HTML::Perlinfo::Modules;

my $m = HTML::Perlinfo::Modules->new();
$m->print_modules;

DESCRIPTION

This module outputs information about your Perl modules in HTML. By default, the module names are sorted alphabetically in a list. This list is also sortable by version number.

Other information displayed:

- Duplicate modules. So if you have CGI.pm installed in different locations, these duplicate modules will be shown.

- Automatic links to module documentation on CPAN (you can also provide your own URLs).

- The number of modules under each directory.

You can chose to show 'core' modules or you can search for specific modules. You can also define search paths. HTML::Perlinfo::Modules searches the Perl include path (from @INC) by default.

You can also highlight specific modules with different colors.

EXAMPLES

	# List all modules, sort them by version, highlight DBI/DBD modules in blue, and label them 'Database modules' 
        $m->print_modules(
                sort_by => 'version',
		color   => ['blue', qr/^(?:dbi|dbd)::/i, 'Database modules']
	 );

	# List all of the installed modules sorted alphabetically
	$m->print_modules;

	# Show me the same thing but turn off the links
	$m->print_modules( links => [0]);

	# List all modules under the /usr directory, override the Apache modules docs with my own root URL, 
        # and highlight CGI modules in red and Win32 modules in yellow
	$m->print_modules(
                from      => '/usr',
  		link      => [qr/Apache::/i, 'http://www.myexample.com/perldoc/'], 
                color     => ['red', qr/CGI::/i, 'CGI modules'],
                color     => ['yellow', qr/Win32::/i, 'Windoze modules']
         );

METHODS

This is the key method in this module. It accepts optional named parameters that dictate the display of module information. Those optional named parameters are:

from

Show modules from specific directories.

This parameter accepts 2 things: a single directory or an array reference (containing directories).

The default value is the Perl include path. This is equivalent of supplying \@INC as a value. If you want to show all of the modules on your box, you can specify '/' as a value (or the disk drive on Windows).

sort_by

You use this parameter to sort the modules. Values can be either 'version' for version number sorting (in descending order) or 'name' for alphabetical sorting (the default).

show_only

This parameter acts like a filter and only shows you the modules (more specifically, the package names) you request. So if, for example, you wanted to only show modules in the Net namspace, you would use the show_only parameter. It is probably the most useful option available for the print_modules method. With this option, you can use HTML::Perlinfo::Modules as a search engine tool for your local Perl modules. Observe:

$m->print_modules(
            show_only => qr/MYCOMPANY::/i,
            section   => 'My Company's Custom Perl Modules',
            show_dir  => 1
    );

The example above will print out every module in the 'MYCOMPANY' namespace in the Perl include path (@INC). The list will be entitled 'My Company's Custom Perl Modules' and because show_dir is set to 1, the list will only show the directories in which these modules were found along with how many are present in each directory.

In addition to a precompiled regular expression, show_only also accepts the word 'core', a value that will show you all of the core Perl modules (in the installarchlib and installprivlib directories from the config file).

show_inc

Whenever you perform a module search, you will see a summary of your search that includes the directories searched and the number of modules found. Whether or not your search encompasses the Perl include path (@INC), you will still see the directories in this special path, along with any directories that were actually searched. If you do not what to see this search summary, you must set show_inc to 0. The default value is 1.

show_dir

Setting this parameter to 1 will only show you the directories in which your modules were found (along with a summary of how many were found, etc). The default value is 0 which shows you the full list of directories in your include path (from @INC), including the directories where your modules were found. If you do not want to show any directories/summary, then you must use the show_inc parameter.

color

This parameter allows you to highlight modules with different colors. Highlighting specific modules is a good way to draw attention to them.

The parameter value must be an array reference containing at least 2 elements. The first element is the color itself which can be either a hex code like #FFD700 or the name of the color. The second element, a precompiled regular expression, specifies the module(s) to color. And the third, optional element in the array reference acts as a label in the color code section. This final element can even be a link if you so desire.

Examples:

	color => ['red', qr/Apache::/i, "<a href='http://perl.apache.org'>Apache modules</a>"],
 	color => ['#FFD700', qr/CGI/i] 	

In the second example, the label defaults to '(?i-xsm:CGI)' since there is no third element.

section

Ever wanted to call your modules by a petname? Or how about just labeling your company's modules with a heading, so you can more quickly discern what you are looking at? The section parameter lets you do that!

	$m->print_modules( show_only=>qr/^(?:DBI::|DBD::)|Oracle/i,
                           show_dir=>1,
                           section=>'Database modules');

	$m->print_modules( show_only=>qr/^Apache::/i,
                           show_dir=>1,
                           section=>'Apache/mod_perl modules');

By default, every module is linked to its documentation on search.cpan.org. However some modules, such as custom modules, would not be in CPAN and their link would not show any documentation. With the 'link' parameter you can override the CPAN link with you own URL.

The parameter value must be an array reference containing two elements. The first element can either be a precompiled regular expression specifying the module(s) to link or the word 'all' which will link all the modules in the list. The second element is the root URL. In the link, the module name will come after the URL. So in the example below, the link for the Apache::Status module would be 'http://www.myexample.com/perldoc/Apache::Status'.

link => [qr/Apache::/i, 'http://www.myexample.com/perldoc/']

Further information about linking is in the HTML documentation.

CUSTOMIZING THE HTML

HTML::Perlinfo::Modules uses the same HTML generation as its parent module, HTML::Perlinfo.

You can capture the HTML output and manipulate it or you can alter CSS elements with object methods.

(Note that you can also highlight certain modules with the color parameter to print_modules.)

For further details and examples, please see the HTML documentation in the HTML::Perlinfo distribution.

BUGS

Please report any bugs or feature requests to bug-html-perlinfo-modules@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Perlinfo-Modules. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

NOTES

Suggestions/comments/code welcomed.

SEE ALSO

HTML::Perlinfo, Module::Info, Module::CoreList.

AUTHOR

Mike Accardo <mikeaccardo@yahoo.com>

COPYRIGHT

  Copyright (c) 2006, Mike Accardo. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License.