|
NAMEHTML::Perlinfo::HTML - HTML documentation for the perlinfo librarySUMMARYHTML::Perlinfo validates as XHTML 1.0 Transitional.In the perlinfo library, HTML::Perlinfo and HTML::Perlinfo::Modules use the internal module HTML::Perlinfo::Common for HTML generation. This document provides information on that HTML and its manipulation. CUSTOMIZING THE HTMLYou can capture the HTML output by assigning it to a scalar. Then you can alter the HTML before printing it or doing something else with it. Here is an example that uses the perlinfo function from HTML::Perlinfo:use HTML::Perlinfo; my $example = perlinfo(); # Now I can do whatever I want with $example $example =~ s/Perl/Java/ig; # Make everyone laugh print $example; Another option is to use object attributes which make altering some HTML elements less helter skelter. OBJECT ATTRIBUTESThese object attributes allow you to change the HTML CSS settings to achieve a stylish effect. Please see your favorite HTML guide for acceptable CSS values. Refer to the HTML source code of the perlinfo page for the defaults.Attribute name/Corresponding CSS element title / page title (only non-CSS element) bg_image / background_image bg_position / background_position bg_repeat / background_repeat bg_attribute / background_attribute bg_color / background_color ft_family / font_familty ft_color / font_color lk_color / link color lk_decoration / link text-decoration lk_bgcolor / link background-color lk_hvdecoration / link hover text-decoration header_bgcolor / table header background-color header_ftcolor / table header font color leftcol_bgcolor / background-color of leftmost table cell leftcol_ftcolor / font color of left table cell rightcol_bgcolor / background-color of right table cell rightcol_ftcolor / font color of right table cell CSS EXAMPLE$p = HTML::Perlinfo->new( bg_image => 'http://i104.photobucket.com/albums/m176/perlinfo/camel.gif', bg_repeat => 'yes-repeat' ); $p->info_all; print_htmlheadThis method prints the head container tags containing the style sheet, along with a few other html tags. It is useful to call this method when full_page is set to 0 and you are piecing together multiple perlinfo pages into one page. For example:$m = HTML::Perlinfo::Modules->new( full_page => 0 ); # Just the bare essentials please $m->print_htmlhead; # Print the beginning of an html document $m->print_modules( from =>'/home/paco', section => 'The Modules in Paco's Home Directory' ); $m->print_modules( from =>'/home/cowboy', section => 'The Modules in Cowboy's Home Directory' ); When full_page is set to 1 (the default value), print_htmlhead is called internally. Note that you can still set CSS values in the constructor even when full_page is set to 0 and see the results in print_htmlhead. $m = HTML::Perlinfo::Modules->new( full_page => 0, bg_color => 'gray' ); $m->print_htmlhead; # Prints a HTML document with a gray background Of course, you don't have to use the print_htmlhead method. You could insert your own HTML with your own style sheet when you set full_page to 0. full_pageDo you want only a fragment of HTML and not a page with body tags (among other things)? Then the full_page option is what you need to use (or a regular expression, as explained above). This option allows you to add your own header/footer if you so desire. By default, the value is 1. Set it to 0 to output the HTML report with as little HTML as possible.$p = HTML::Perlinfo->new( full_page => 0 ); # Change value to 1 to get a full HTML page linksBy default, there will be useful links in most of the presented HTML in the perlinfo library. These links are for pages on search.cpan.org. Even the info_config method lists links to the config options in the core Config module.To manipulate links in the perlinfo library, you can use the links attribute in the info methods. Not to be confused with the "link" attribute in the HTML::Perlinfo::Module (which allows you to provide your own links for modules), this attribute's primary purpose is to turn on linking or turn it off. Of course, you can achieve the same effect by using regular expressions, as explained above. But using the links attribute makes your code cleaner. There are several arguments (in an array reference) you can supply to the links attribute. The number 1 turns on all default links and 0 will remove them. For example, to remove the default links in the info_all method, you would say: $p->info_all( links=>[0] ); # contains no links. Good for printing! The example above removes all default links and it even ignores the link parameter in the print_modules method of HTML::Perlinfo::Modules. The named parameters for the links attribute are 'docs' and 'local' which controls links associated with modules, programs in the Perl utilities section, and the Config section and everywhere else. The value for either parameter can be either '1' or '0'.
NOTESHTML::Perlinfo::Modules allows you to color code specific modules.More HTML options should be available in future revisions. Want to see a new feature/change? Then contact me about it. AUTHORMike Accardo <accardo@cpan.org>COPYRIGHTCopyright (c) 2009, Mike Accardo. All Rights Reserved.
Visit the GSP FreeBSD Man Page Interface. |