GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DANCER2::PLUGIN::PATH::CLASS (3)

.ds Aq ’

NAME

Dancer2::Plugin::Path::Class - list a directory using Path::Class

CONTENTS

VERSION

version 0.04

SYNOPSIS



  use 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:
ls_name The basename of the path.
ls_cdup The parent of the request path.
ls_dirs A list of subdirectories if the path is a directory object. The subdirs are decorated with name, file_count and a list of (sub) subdirs.
ls_files A list of files or just one file if the path is a file object. The files are decorated with name, date, size and type.
All objects must be readable. Names starting with a dot (’.’) or ending with a tilde (’~’) are ignored.

AUTHOR

Henk van Oers, HVOERS@cpan.org

CONTRIBUTORS



    Peter Mottram



COPYRIGHT and LICENSE

Copyright (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 ALSO

Path::Class, Dancer2
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DANCER2::PLUGIN::PATH::CLASS (3) 2016-01-22

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.