comparison extra/svn/SoundSoftware.pm @ 152:a389c77da9fd live

* Debug output; trying to trace intermittent DBI errors
author Chris Cannam
date Tue, 25 Jan 2011 11:48:49 +0000
parents 8100616a9904
children
comparison
equal deleted inserted replaced
148:e47742d68d2d 152:a389c77da9fd
158 my %read_only_methods = map { $_ => 1 } qw/GET PROPFIND REPORT OPTIONS/; 158 my %read_only_methods = map { $_ => 1 } qw/GET PROPFIND REPORT OPTIONS/;
159 159
160 sub access_handler { 160 sub access_handler {
161 my $r = shift; 161 my $r = shift;
162 162
163 print STDERR "SoundSoftware.pm: In access handler\n"; 163 print STDERR "SoundSoftware.pm: In access handler at " . scalar localtime() . "\n";
164 164
165 unless ($r->some_auth_required) { 165 unless ($r->some_auth_required) {
166 $r->log_reason("No authentication has been configured"); 166 $r->log_reason("No authentication has been configured");
167 return FORBIDDEN; 167 return FORBIDDEN;
168 } 168 }
176 print STDERR "SoundSoftware.pm: Method is not read-only, authentication handler required\n"; 176 print STDERR "SoundSoftware.pm: Method is not read-only, authentication handler required\n";
177 return OK; 177 return OK;
178 } 178 }
179 179
180 my $dbh = connect_database($r); 180 my $dbh = connect_database($r);
181 unless ($dbh) {
182 print STDERR "SoundSoftware.pm: Database connection failed!: " . $DBI::errstr . "\n";
183 return FORBIDDEN;
184 }
185
186
187 print STDERR "Connected to db, dbh is " . $dbh . "\n";
181 188
182 my $project_id = get_project_identifier($dbh, $r); 189 my $project_id = get_project_identifier($dbh, $r);
183 my $status = get_project_status($dbh, $project_id, $r); 190 my $status = get_project_status($dbh, $project_id, $r);
184 191
185 $dbh->disconnect(); 192 $dbh->disconnect();
199 } 206 }
200 207
201 sub authen_handler { 208 sub authen_handler {
202 my $r = shift; 209 my $r = shift;
203 210
204 print STDERR "SoundSoftware.pm: In authentication handler\n"; 211 print STDERR "SoundSoftware.pm: In authentication handler at " . scalar localtime() . "\n";
205 212
206 my $dbh = connect_database($r); 213 my $dbh = connect_database($r);
214 unless ($dbh) {
215 print STDERR "SoundSoftware.pm: Database connection failed!: " . $DBI::errstr . "\n";
216 return AUTH_REQUIRED;
217 }
207 218
208 my $project_id = get_project_identifier($dbh, $r); 219 my $project_id = get_project_identifier($dbh, $r);
209 my $realm = get_realm($dbh, $project_id, $r); 220 my $realm = get_realm($dbh, $project_id, $r);
210 $r->auth_name($realm); 221 $r->auth_name($realm);
211 222
413 424
414 my $cfg = Apache2::Module::get_config 425 my $cfg = Apache2::Module::get_config
415 (__PACKAGE__, $r->server, $r->per_dir_config); 426 (__PACKAGE__, $r->server, $r->per_dir_config);
416 427
417 return DBI->connect($cfg->{SoundSoftwareDSN}, 428 return DBI->connect($cfg->{SoundSoftwareDSN},
418 $cfg->{SoundSoftwareDbUser}, 429 $cfg->{SoundSoftwareDbUser},
419 $cfg->{SoundSoftwareDbPass}); 430 $cfg->{SoundSoftwareDbPass});
420 } 431 }
421 432
422 1; 433 1;