LEFT | RIGHT |
(no file at all) | |
1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
2 # Copyright 2011 The Go Authors. All rights reserved. | 2 # Copyright 2011 The Go Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style | 3 # Use of this source code is governed by a BSD-style |
4 # license that can be found in the LICENSE file. | 4 # license that can be found in the LICENSE file. |
5 # | 5 # |
6 # Test script run as a child process under cgi_test.go | 6 # Test script run as a child process under cgi_test.go |
7 | 7 |
8 use strict; | 8 use strict; |
9 use CGI; | 9 use CGI; |
| 10 use Cwd; |
10 | 11 |
11 my $q = CGI->new; | 12 my $q = CGI->new; |
12 my $params = $q->Vars; | 13 my $params = $q->Vars; |
13 | 14 |
14 if ($params->{"loc"}) { | 15 if ($params->{"loc"}) { |
15 print "Location: $params->{loc}\r\n\r\n"; | 16 print "Location: $params->{loc}\r\n\r\n"; |
16 exit(0); | 17 exit(0); |
17 } | 18 } |
18 | 19 |
19 my $NL = "\r\n"; | 20 my $NL = "\r\n"; |
(...skipping 12 matching lines...) Expand all Loading... |
32 | 33 |
33 foreach my $k (sort keys %$params) { | 34 foreach my $k (sort keys %$params) { |
34 print "param-$k=$params->{$k}\n"; | 35 print "param-$k=$params->{$k}\n"; |
35 } | 36 } |
36 | 37 |
37 foreach my $k (sort keys %ENV) { | 38 foreach my $k (sort keys %ENV) { |
38 my $clean_env = $ENV{$k}; | 39 my $clean_env = $ENV{$k}; |
39 $clean_env =~ s/[\n\r]//g; | 40 $clean_env =~ s/[\n\r]//g; |
40 print "env-$k=$clean_env\n"; | 41 print "env-$k=$clean_env\n"; |
41 } | 42 } |
| 43 |
| 44 # NOTE: don't call getcwd() for windows. |
| 45 # msys return /c/go/src/... not C:\go\... |
| 46 my $dir; |
| 47 if ($^O eq 'MSWin32' || $^O eq 'msys') { |
| 48 my $cmd = $ENV{'COMSPEC'} || 'c:\\windows\\system32\\cmd.exe'; |
| 49 $cmd =~ s!\\!/!g; |
| 50 $dir = `$cmd /c cd`; |
| 51 chomp $dir; |
| 52 } else { |
| 53 $dir = getcwd(); |
| 54 } |
| 55 print "cwd=$dir\n"; |
LEFT | RIGHT |