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

package base;
use strict;
use warnings;
use nginx;
sub handler {
my $r = shift();
$r->send_http_header("text/plain");
return OK if $r->header_only();
$r->print("Hello There!\n");
$r->rflush();
if (-f $r->filename or -d _) {
$r->print($r->uri, " exists!\n");
} 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);
}
}
1;
__END__