gitweb: Declare global variables with "our"
Variables declared with "my" in the file scope cannot be accessed from subroutines with mod_perl. Signed-off-by: Junio C Hamano <junkio@cox.net>
Dennis Stosberg committed
Jun 21, 2006 at 15:07 UTC
dc6d9b4999bfdf6bcabf8803f9fa886eb9eaba28
1 file changed
+27
-28
gitweb/gitweb.cgi
+27
-28
@@ -16,21 +16,21 @@ use Encode;
16
use Fcntl ':mode';
17
binmode STDOUT, ':utf8';
18
19
-my $cgi = new CGI;
20
-my $version = "267";
21
-my $my_url = $cgi->url();
22
-my $my_uri = $cgi->url(-absolute => 1);
23
-my $rss_link = "";
19
+our $cgi = new CGI;
20
+our $version = "267";
21
+our $my_url = $cgi->url();
22
+our $my_uri = $cgi->url(-absolute => 1);
23
+our $rss_link = "";
24
25
# location of the git-core binaries
26
-my $gitbin = "/usr/bin";
26
+our $gitbin = "/usr/bin";
27
28
# absolute fs-path which will be prepended to the project path
29
-#my $projectroot = "/pub/scm";
30
-my $projectroot = "/home/kay/public_html/pub/scm";
29
+#our $projectroot = "/pub/scm";
30
+our $projectroot = "/home/kay/public_html/pub/scm";
31
32
# version of the git-core binaries
33
-my $git_version = qx($gitbin/git --version);
33
+our $git_version = qx($gitbin/git --version);
34
if ($git_version =~ m/git version (.*)$/) {
35
$git_version = $1;
36
} else {
@@ -38,32 +38,31 @@ if ($git_version =~ m/git version (.*)$/) {
38
}
39
40
# location for temporary files needed for diffs
41
-my $git_temp = "/tmp/gitweb";
41
+our $git_temp = "/tmp/gitweb";
42
43
# target of the home link on top of all pages
44
-my $home_link = $my_uri;
44
+our $home_link = $my_uri;
45
46
# html text to include at home page
47
-my $home_text = "indextext.html";
47
+our $home_text = "indextext.html";
48
49
# URI of default stylesheet
50
-my $stylesheet = "gitweb.css";
50
+our $stylesheet = "gitweb.css";
51
52
# source of projects list
53
-#my $projects_list = $projectroot;
54
-my $projects_list = "index/index.aux";
53
+#our $projects_list = $projectroot;
54
+our $projects_list = "index/index.aux";
55
56
# default blob_plain mimetype and default charset for text/plain blob
57
-my $default_blob_plain_mimetype = 'text/plain';
58
-my $default_text_plain_charset = undef;
57
+our $default_blob_plain_mimetype = 'text/plain';
58
+our $default_text_plain_charset = undef;
59
60
# file to use for guessing MIME types before trying /etc/mime.types
61
# (relative to the current git repository)
62
-my $mimetypes_file = undef;
63
-
62
+our $mimetypes_file = undef;
63
64
# input validation and dispatch
66
-my $action = $cgi->param('a');
65
+our $action = $cgi->param('a');
66
if (defined $action) {
67
if ($action =~ m/[^0-9a-zA-Z\.\-_]/) {
68
undef $action;
@@ -78,7 +77,7 @@ if (defined $action) {
77
}
78
}
79
81
-my $order = $cgi->param('o');
80
+our $order = $cgi->param('o');
81
if (defined $order) {
82
if ($order =~ m/[^0-9a-zA-Z_]/) {
83
undef $order;
@@ -86,7 +85,7 @@ if (defined $order) {
85
}
86
}
87
89
-my $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
88
+our $project = ($cgi->param('p') || $ENV{'PATH_INFO'});
89
if (defined $project) {
90
$project =~ s|^/||; $project =~ s|/$||;
91
$project = validate_input($project);
@@ -109,7 +108,7 @@ if (defined $project) {
108
exit;
109
}
110
112
-my $file_name = $cgi->param('f');
111
+our $file_name = $cgi->param('f');
112
if (defined $file_name) {
113
$file_name = validate_input($file_name);
114
if (!defined($file_name)) {
@@ -117,7 +116,7 @@ if (defined $file_name) {
116
}
117
}
118
120
-my $hash = $cgi->param('h');
119
+our $hash = $cgi->param('h');
120
if (defined $hash) {
121
$hash = validate_input($hash);
122
if (!defined($hash)) {
@@ -125,7 +124,7 @@ if (defined $hash) {
124
}
125
}
126
128
-my $hash_parent = $cgi->param('hp');
127
+our $hash_parent = $cgi->param('hp');
128
if (defined $hash_parent) {
129
$hash_parent = validate_input($hash_parent);
130
if (!defined($hash_parent)) {
@@ -133,7 +132,7 @@ if (defined $hash_parent) {
132
}
133
}
134
136
-my $hash_base = $cgi->param('hb');
135
+our $hash_base = $cgi->param('hb');
136
if (defined $hash_base) {
137
$hash_base = validate_input($hash_base);
138
if (!defined($hash_base)) {
@@ -141,7 +140,7 @@ if (defined $hash_base) {
140
}
141
}
142
144
-my $page = $cgi->param('pg');
143
+our $page = $cgi->param('pg');
144
if (defined $page) {
145
if ($page =~ m/[^0-9]$/) {
146
undef $page;
@@ -149,7 +148,7 @@ if (defined $page) {
148
}
149
}
150
152
-my $searchtext = $cgi->param('s');
151
+our $searchtext = $cgi->param('s');
152
if (defined $searchtext) {
153
if ($searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
154
undef $searchtext;