NAME
PHP::Perlinfo - Clone of PHP's phpinfo function for Perl
SYNOPSIS
use PHP::Perlinfo;
perlinfo();
DESCRIPTION
This module outputs a large amount of information (only in HTML in this release) about the current state of Perl. So far, this includes information about Perl compilation options, the Perl version, server information and environment, HTTP headers, OS version information, Perl modules, and the Perl License.
Since the module outputs HTML, you may want to use it in a CGI script, but you do not have to. Of course, some information, like HTTP headers, would not be available if you use the module at the command-line.
It is based on PHP's phpinfo function. Like other clones of PHP functions on CPAN, perlinfo attempts to mimic the PHP function is as many ways as possible. But, of course, there are some differences in the Perl version. These differences will be logged in future revisions.
PHP's phpinfo function is usually one of the first things a new PHP programmer learns. It is a very useful function for debugging and checking configuration settings. I expect that many users of this module will already know PHP's phpinfo. To familiarize yourself with phpinfo, you can google "phpinfo" and see the output for phpinfo in one of the many results. (I rather not provide a link that can go bad with the passage of time.)
OPTIONS
There are 6 options to pass to the perlinfo funtion. All of these options are also object methods. The key difference is their case: Captilize the option name when passing it to the function and use only lower-case letters when using the object-oriented approach.
- INFO_GENERAL
-
The configuration line, build date, Web Server, System and more.
- INFO_LICENSE
-
Perl license information.
- INFO_MODULES
-
Local modules, their version number and more.
- INFO_VARIABLES
-
Shows all predefined variables from EGPCS (Environment, GET, POST, Cookie, Server). This is not fully implemented yet.
- INFO_CREDITS
-
Shows the credits for Perl, listing the Perl pumpkings, developers, module authors, etc.
- INFO_ALL
-
Shows all of the above. This is the default value.
OBJECT METHODS
These object methods allow you to change the HTML CSS settings to achieve a stylish effect. You must pass them a parameter or your program will die. Please see your favorite HTML guide for acceptable CSS values. Refer to the HTML source code of perlinfo for the defaults.
Method name/Corresponding 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
Remember that there are more methods (the info options listed above).
EXAMPLES
Function-oriented style:
# Show all information, defaults to INFO_ALL
perlinfo();
# Show only module information
perlinfo(INFO_MODULES);
Object-oriented style:
$p = new PHP::Perlinfo;
$p->bg_color("#eae5c8");
$p->info_all;
# You can also set the CSS values in the constructor!
$p = PHP::Perlinfo->new(
bg_image => 'http://www.tropic.org.uk/~edward/ctrip/images/camel.gif',
bg_repeat => 'yes-repeat'
);
$p->info_all;
More examples . . .
# This is wrong (no capitals!)
$p->INFO_CREDITS;
# But this is correct
perlinfo(INFO_CREDITS);
# Ditto
$p->info_credits;
NOTES
This module is still in the early stages of development. Many new additions and changes are planned.
Perlinfo lacks many important features that are in the PHP version. These features are not hard to implement but finding the time to add them is. Help wanted! Please email me if you want to help out. Thanks.
SEE ALSO
Config. You can also use "perl -V" to see a configuration summary.
Perl Diver and Perl Digger are free CGI scripts that offer similar information.
Perl Diver: http://www.scriptsolutions.com/programs/free/perldiver/
Perl Digger: http://sniptools.com/perldigger
You can also read the description of the original PHP version:
http://www.php.net/manual/en/function.phpinfo.php
AUTHOR
Mike Accardo <mikeaccardo@yahoo.com> Suggestions and comments welcomed.
COPYRIGHT
Copyright (c) 2005, 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.