Merge remote-tracking (subtree) branch 'PracticingPerl/master'
This commit is contained in:
38
PracticingPerl/web/lib/perl/base.pm
Normal file
38
PracticingPerl/web/lib/perl/base.pm
Normal file
@@ -0,0 +1,38 @@
|
||||
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__
|
Reference in New Issue
Block a user