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 'all' modules in the default module (@INC) directories. Additionally you can specify specific paths to search.
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(
show => all, # everything in @INC
sort => 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->no_links;
$m->print_modules;
# 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(
show => '/usr',
link => [qr/Apache::/i, 'http://perldoc.dv.valueclick.com/perldoc/'],
color => ['red', qr/CGI::/i, 'CGI modules'],
color => ['yellow', qr/Win32::/i, 'Windoze modules']
);
METHODS
print_modules
This is the key method in this module. It accepts optional named parameters that dictate the display of information. Those optional named parameters are:
show
Show modules under specific directories.
This parameter accepts 4 different things: a single directory, an array reference, the word 'core', the word 'all'.
'core' shows only core modules (ie, modules included in your Perl distribution). It searches the installarchlib and installprivlib directories listed in the config file.
'all' shows modules in the @INC directories. This is equivalent of supplying \@INC as a value. If you want to show all of the modules on your file system, you can specify '/' as a value (or the disk drive on Windows).
sort
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).
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.
link
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, a precompiled regular expression, specifies the module(s) to link. 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://perldoc.dv.valueclick.com/perldoc/Apache::Status'.
link => [qr/Apache::/i, 'http://perldoc.dv.valueclick.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. This is the first release of this module, so expect big changes to come.
SEE ALSO
HTML::Perinfo, 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.