Any-Daemon-HTTP

 view release on metacpan or  search on metacpan

lib/Any/Daemon/HTTP/Directory.pm  view on Meta::CPAN

    ref $postfilter eq 'CODE'
        or panic "::Directory::list(filter) must be code, not $postfilter";

    my $hide_symlinks = $opts{hide_symlinks};

    my (%dirlist, %users, %groups);
    foreach my $name (grep $prefilter->($_), readdir $from_dir)
    {   my $path = $dirname.$name;
        my %d    = (name => $name, path => $path);
        @d{@stat_fields}
            = $hide_symlinks ? stat($path) : lstat($path);

           if(!$hide_symlinks && -l _)
                    { @d{qw/kind is_symlink  /} = ('SYMLINK',  1)}
        elsif(-d _) { @d{qw/kind is_directory/} = ('DIRECTORY',1)}
        elsif(-f _) { @d{qw/kind is_file     /} = ('FILE',     1)}
        else        { @d{qw/kind is_other    /} = ('OTHER',    1)}

        $postfilter->(\%d)
            or next;

lib/Any/Daemon/HTTP/Directory.pod  view on Meta::CPAN


 -Option       --Default
  filter         <undef>
  hide_symlinks  <false>
  names          <skip hidden files>

=over 2

=item filter => CODE

For each of the selected names (see  C<names> option) the lstat() is
called.  That data is expanded into a HASH, but not all additional
fields are yet filled-in (only the ones which come for free).

=item hide_symlinks => BOOLEAN

=item names => CODE|Regexp

Reduce the returned list.  The CODE reference is called with the found
filename, and should return true when the name is acceptable.  The
default regexp (on UNIX) is C<< qr/^[^.]/ >>



( run in 1.089 second using v1.01-cache-2.11-cpan-49f99fa48dc )