User Tools

Site Tools


print_environment_using_perl_cgi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

print_environment_using_perl_cgi [2018/08/22 16:57] (current)
k2patel created
Line 1: Line 1:
 +====== Print Environment variable ======
  
 +# this is really helpful while working with proxy etc..
 +
 +<code perl>
 +#​!/​usr/​bin/​perl -wT
 +
 +use strict;
 +use Net::Domain qw(hostname hostfqdn hostdomain);​
 +use CGI qw(:​standard);​
 +use CGI::Carp qw(warningsToBrowser fatalsToBrowser);​
 +
 +print header;
 +print start_html("​Environment"​);​
 +
 +foreach my $key (sort(keys(%ENV))) {
 +    print "$key = $ENV{$key}<​br>​\n";​
 +}
 +
 +my $fqdn = hostfqdn();
 +
 +print "​Hostname = $fqdn \n";
 +
 +print end_html;
 +</​code>​
print_environment_using_perl_cgi.txt ยท Last modified: 2018/08/22 16:57 by k2patel