From 9b76d38ad3dc8f7135e5c2b1594e6815790808bc Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 2 Oct 2007 12:23:56 +0200 Subject: [PATCH] eg/plpinfo.plp demo/status page Demo page reporting about the current status of Perl and PLP. Useful as test page (see if correct versions are loaded as they should, and what variables are set), or at least as a somewhat larger example of a plp page. Modelled closely after PHP's phpinfo() output (even color scheme is the same, albeit html is much cleaner) to keep it as familiar as possible to php switcheroos. --- eg/plpinfo.plp | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 eg/plpinfo.plp diff --git a/eg/plpinfo.plp b/eg/plpinfo.plp new file mode 100644 index 0000000..9578327 --- /dev/null +++ b/eg/plpinfo.plp @@ -0,0 +1,76 @@ + + + +plpinfo() + + + + +

PLP Version <:= $PLP::VERSION :>

+ + +<: +use Config; +printf "\n", @$_ for ( + ["System" => qx(uname -snrvm)], + ["Server API" => "CGI/FastCGI - ".$PLP::interface], #TODO + ["Perl" => join ".", map ord, split //, $^V], + ["Build Date" => $Config{cf_time}], + ["Debug Build" => $^P ? "yes" : "no"], + ["Thread Safety" => $Config{usethreads} ? "enabled" : "disabled"], + ["Include Path" => join "; ", @INC], +); +:>
%s%s
+ +

PLP Core

+ + +<: +my %modules; +s!/!::!g, s/\.pm$// and $modules{$_} = $_->VERSION || "" for keys %INC; +printf "\n", @$_ for ( + ["Modules" => join "
\n", + map "$_ $modules{$_}", sort grep /^PLP/, keys %modules + ], + ["Debug Output" => join "; ", + $PLP::DEBUG & 1 ? "run-time errors" : (), + $PLP::DEBUG & 2 ? "headers" : (), + ], + ["Caching" => $PLP::use_cache ? "on" : "off"], #TODO +); +:>
%s%s
+ +

Environment

+ + +<: +s/(?<=,)//g for values %ENV; # allow breaks at commas (HTTP_ACCEPT*) +printf("\n", + $_, defined $ENV{$_} ? $ENV{$_} : "no value" +) for sort keys %ENV; +:>
%s%s
+ +

PLP Variables

+ + +<: +for my $var qw(get post cookies header) { + printf("\n", + $var, $_, defined $$var{$_} ? $$var{$_} : "no value" + ) for sort keys %$var; +} +:>
%s{'%s'}%s
+ + + -- 2.30.0