Is there something like <?php phpinfo(); ?>
in Perl?
views:
151answers:
3
A:
For clarification I have included the bash prompt symbol.
$ perl --version # This is what I would use
Josh K
2010-09-18 06:06:02
it should be called from the script, not from the console. Thanks anyway!
elektronikLexikon
2010-09-18 06:11:02
`my $info = \`perl --version\`; # You're welcome`
hlynur
2010-09-18 06:18:07
`# oops, the perl in the path is not the one running this script. you were running suid and "perl" was actually a shell script placed into $PATH that deletes everything on the system. (at least your script got deleted too.)`
jrockway
2010-09-18 06:35:40
If you want to get the version, just use the $^V variable inside the program.
brian d foy
2010-09-18 07:12:43
@jrockway: If that is the case you have bigger problems then a faulty script, the main one being high levels of dumbass present.
Josh K
2010-09-18 08:26:33
@Josh: Nope, the main problem here is that you're doing the wrong thing. The 'perl' in your answer might not be the only one there is or the one you intend to use. When there's a much better answer, there's no sense defending such a poor one with a distraction about other problems. Just do it right from the start.
brian d foy
2010-09-18 10:13:24
+8
A:
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.
- The
Config
module, which comes with Perl, has the compilation options for the interpreter - The Probe::Perl might give you a better interface
$^V
has the version of the current interpreter (see perlvar)%ENV
has the environment (see perlvar)- You can use the Devel::CheckOS module to find out about the OS
- Unless you are using mod_perl, your Perl CGI script will probably not have direct access to HTTP headers
brian d foy
2010-09-18 07:22:01