You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
641 B
39 lines
641 B
14 years ago
|
package base;
|
||
14 years ago
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
14 years ago
|
use nginx;
|
||
|
|
||
|
|
||
|
sub handler {
|
||
14 years ago
|
my $r = shift();
|
||
|
|
||
14 years ago
|
$r->send_http_header("text/plain");
|
||
14 years ago
|
return OK if $r->header_only();
|
||
14 years ago
|
|
||
14 years ago
|
$r->print("Hello There!\n");
|
||
|
$r->rflush();
|
||
14 years ago
|
|
||
|
if (-f $r->filename or -d _) {
|
||
|
$r->print($r->uri, " exists!\n");
|
||
14 years ago
|
} else {
|
||
|
$r->print($r->uri, " does not exist!\n");
|
||
|
}
|
||
|
|
||
|
my $directory = '/home/me/tmp';
|
||
|
# '/home/me/src/LearningPerl/src/web';
|
||
|
|
||
|
my $didopen = opendir(DIR, $directory);
|
||
|
if ($didopen) {
|
||
|
while (my $file = readdir(DIR)) {
|
||
|
$r->print("$file\n");
|
||
|
}
|
||
|
|
||
|
closedir(DIR);
|
||
14 years ago
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
1;
|
||
|
__END__
|