env.pl
50 lines of code
1
#!/usr/local/bin/perl
2
3
binmode(STDIN, ":utf8");
4
binmode(STDOUT, ":utf8");
5
6
# must have's!
7
use strict;
8
use warnings;
9
use CGI::Carp qw(fatalsToBrowser);
10
use URI::Escape;
11
12
use lib "/var/www/html/Pm";
13
use Bc_misc qw(get_param);
14
15
my $e = get_param("ev");
16
my $DEBUG = 1;
17
18
my $output;
19
20
############################################################
21
22
### YOUR CONTENT HERE
23
$output = "content-type: text/plain\n\n";
24
if ($DEBUG) {
25
  if ($e) {
26
    $output .= "\n\nasked for: $e\n";
27
    $output .= "got: $ENV{$e}\n";
28
  } else {
29
    $output .= "asked for nothing, showing whole list of ENV vars\n";
30
  }
31
}
32
33
sub test() {
34
}
35
36
my $subref = \&test;
37
38
if (!$e) {
39
  foreach my $key (keys %ENV) {
40
    $output .= "\$ENV{$key}=$ENV{$key}\n";
41
  }
42
} else {
43
  $output .= $ENV{$e};
44
}
45
46
############################################################
47
48
print $output;
49
50
exit 1;