Reputation: 2613
Is there something like <?php phpinfo(); ?>
in Perl?
Upvotes: 6
Views: 2493
Reputation: 8036
Just to add on, dont forget to add the Perl bin path in your file.
An example script I used follows:
Make sure that the following line is the first in your file:
#!/usr/bin/perl
OR For windows, may be something like(depending on your environment):
#!C:/wamp/bin/Perl64/bin/perl.exe
Snippet:
#!/usr/bin/perl
# test.cgi by Bill Weinman [http://bw.org/]
# Copyright 1995-2008 The BearHeart Group, LLC
# Free Software: Use and distribution under the same terms as perl.
use strict;
use warnings;
use CGI;
print foreach (
"Content-Type: text/plain\n\n",
"BW Test version 5.0\n",
"Copyright 1995-2008 The BearHeart Group, LLC\n\n",
"Versions:\n=================\n",
"perl: $]\n",
"CGI: $CGI::VERSION\n"
);
my $q = CGI::Vars();
print "\nCGI Values:\n=================\n";
foreach my $k ( sort keys %$q ) {
print "$k [$q->{$k}]\n";
}
print "\nEnvironment Variables:\n=================\n";
foreach my $k ( sort keys %ENV ) {
print "$k [$ENV{$k}]\n";
}
Source: http://cgi.bw.org/cgi-t/
Upvotes: 1
Reputation: 132802
What information do you want to know? phpinfo apparently tells you almost everything:
Outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License.
You can get most of that somehow in Perl, but not all from the same place.
Config
module, which comes with Perl, has the compilation options for the interpreter$^V
has the version of the current interpreter (see perlvar)%ENV
has the environment (see perlvar)Upvotes: 11
Reputation: 28883
For clarification I have included the bash prompt symbol.
$ perl --version # This is what I would use
Upvotes: 0