X-Git-Url: http://git.rot13.org/?p=cloudstore.git;a=blobdiff_plain;f=web-api.pl;fp=web-api.pl;h=2adcf2a689e3484b17ba6d97d46f92334713902f;hp=880214938e6595f2743a84906575e41117dd319d;hb=d112331994378a1498d13d4b6f782298aa304b5b;hpb=e323070a547151bc6f9ac514dd34314be24c5ae3 diff --git a/web-api.pl b/web-api.pl index 8802149..2adcf2a 100755 --- a/web-api.pl +++ b/web-api.pl @@ -2,6 +2,7 @@ use Mojolicious::Lite; use Data::Dump qw(dump); +use Cwd; # Documentation browser under "/perldoc" (this plugin requires Perl 5.10) plugin 'pod_renderer'; @@ -18,16 +19,21 @@ warn "XXXXX ", dump( $self->req->url->path->to_string ); return $self->redirect_to( $path ) if -f $path; + my $cwd = getcwd; + chdir $path; + # need to chdir because glob seems to have limited length return values + my $files = [ map { $_ .= '/' if -d $_; - s{$path/}{}; $_; } - glob "$path/*" + glob '*' ]; - warn "# path $path ",dump($files); + chdir $cwd; + + warn "# path ",dump($path, $files); $self->stash( files => $files ); };