![]() |
![]()
| ![]() |
![]()
NAMEDancer2::Plugin::Path::Class - list a directory using Path::Class VERSIONversion 0.07 SYNOPSISuse Dancer2::Plugin::Path::Class; get '/img' => sub { my $dir = ls(config->{public}, '/img'); template 'dirlisting'; }; get '/img/**' => sub { my ($path) = splat; my @splat = @{$path}; my $dir = ls(config->{public}, '/img', @splat); return template 'dirlisting' if -d $dir; send_file("$dir", system_path =>1); }; In your template: <div><a href="[% vars.ls_cdup %]"> [% vars.ls_cdup %]</a>/[% vars.ls_name %]</div> [% FOREACH dir IN vars.ls_dirs %] ... [% FOREACH file IN vars.ls_files %] ... DESCRIPTION"Dancer2::Plugin::Path::Class" exports the "ls" function returning a "Path::Class" object. The "ls" function also sets the following vars:
All objects must be readable. Names starting with a dot ('.') or ending with a tilde ('~') are ignored. AUTHORHenk van Oers, HVOERS@cpan.org CONTRIBUTORSPeter Mottram COPYRIGHT and LICENSECopyright (c) Henk van Oers. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSOPath::Class, Dancer2
|