.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "File::DirList 3pm" .TH File::DirList 3pm "2022-10-13" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" File::DirList \- provide a sorted list of directory content .PP Version 0.04 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use File::DirList; \& # \& my @list = File::DirList::list(\*(Aq.\*(Aq, \*(Aqdn\*(Aq, 1, 0); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is used to get a list of directory content. It is a simple wrapper around DirHandle and \fBsort()\fR .PP The module has two methods: .ie n .IP """list($dirName, $sortMode, $noLinks, $hideDotFiles, $showSelf)""" 4 .el .IP "\f(CWlist($dirName, $sortMode, $noLinks, $hideDotFiles, $showSelf)\fR" 4 .IX Item "list($dirName, $sortMode, $noLinks, $hideDotFiles, $showSelf)" Produces a list, accepting 5 parameters: .RS 4 .ie n .IP "$dirName" 4 .el .IP "\f(CW$dirName\fR" 4 .IX Item "$dirName" Name of the directory to list .ie n .IP "$sortMode" 4 .el .IP "\f(CW$sortMode\fR" 4 .IX Item "$sortMode" Describes how list should be sorted. .Sp This is a string containing the following symbols, with uppercase representing the reverse sort: .RS 4 .ie n .IP """d"" or ""D""" 4 .el .IP "\f(CWd\fR or \f(CWD\fR" 4 .IX Item "d or D" \&\*(L"Directory\*(R" sort. \f(CW\*(Aqd\*(Aq\fR means all the directories will precede files, \f(CW\*(AqD\*(Aq\fR means reverse. .ie n .IP """n"" or ""N""" 4 .el .IP "\f(CWn\fR or \f(CWN\fR" 4 .IX Item "n or N" Sort by file (or subdirectory) name. .ie n .IP """i"" or ""I""" 4 .el .IP "\f(CWi\fR or \f(CWI\fR" 4 .IX Item "i or I" Same as \f(CW\*(Aqn\*(Aq\fR but case insensitive. .ie n .IP """m"" or ""M""" 4 .el .IP "\f(CWm\fR or \f(CWM\fR" 4 .IX Item "m or M" Sort by modification time. .ie n .IP """c"" or ""C""" 4 .el .IP "\f(CWc\fR or \f(CWC\fR" 4 .IX Item "c or C" Sort by creation time. .ie n .IP """a"" or ""A""" 4 .el .IP "\f(CWa\fR or \f(CWA\fR" 4 .IX Item "a or A" Sort by access time. .ie n .IP """s"" or ""S""" 4 .el .IP "\f(CWs\fR or \f(CWS\fR" 4 .IX Item "s or S" Sort by size. .RE .RS 4 .Sp \&\f(CW$sortMode\fR is interpreted from left to right. If the first comparison produces an equal result next one is used. For example, string \f(CW\*(C`\f(CI\*(Aqdin\*(Aq\f(CW\*(C'\fR produces a list with all the directories preceding files, directories and files are sorted by name case insensitively, with lowercase letters preceding upper case. .RE .ie n .IP "$noLinks" 4 .el .IP "\f(CW$noLinks\fR" 4 .IX Item "$noLinks" If \f(CW\*(C`true\*(C'\fR symbolic links will not be examined. Set it on platforms without symlink support. .ie n .IP "$hideDotFiles" 4 .el .IP "\f(CW$hideDotFiles\fR" 4 .IX Item "$hideDotFiles" If \f(CW\*(C`true\*(C'\fR \fI'dot'\fR files will not be reported. .ie n .IP "$showSelf" 4 .el .IP "\f(CW$showSelf\fR" 4 .IX Item "$showSelf" If \f(CW\*(C`true\*(C'\fR \fI'.'\fR directory entry will be reported. .RE .RS 4 .Sp Returned value is an array reference, sorted as described by \f(CW$sortMode\fR. .Sp Array elements are array references representing an item. .Sp The individual item's array contains 17 elements: .ie n .IP """[0..12]""" 4 .el .IP "\f(CW[0..12]\fR" 4 .IX Item "[0..12]" Result of \fBstat()\fR for this item. For valid symbolic links, the stat of the target item is returned. .ie n .IP """[13]""" 4 .el .IP "\f(CW[13]\fR" 4 .IX Item "[13]" Name of the item. .ie n .IP """[14]""" 4 .el .IP "\f(CW[14]\fR" 4 .IX Item "[14]" Is item a directory? Contains 0 for non-directory items, 1 for directories, 2 for \f(CW\*(Aq..\*(Aq\fR, 3 for \f(CW\*(Aq.\*(Aq\fR. Used by \*(L"d or D\*(R" sorting. .ie n .IP """[15]""" 4 .el .IP "\f(CW[15]\fR" 4 .IX Item "[15]" Is item a link? \f(CW0\fR for non-links, \f(CW1\fR for valid links, \f(CW\*(C`\-1\*(C'\fR for invalid links. .ie n .IP """[16]""" 4 .el .IP "\f(CW[16]\fR" 4 .IX Item "[16]" Link target. \f(CW\*(C`\f(CIundef\f(CW\*(C'\fR for non-links, target path for links. .RE .RS 4 .Sp [15] and [16] are set to non-link if \f(CW$examineLinks\fR is \f(CW\*(C`false\*(C'\fR. .RE .ie n .IP """sortList($list, $sortMode)""" 4 .el .IP "\f(CWsortList($list, $sortMode)\fR" 4 .IX Item "sortList($list, $sortMode)" Used to re-sort a list produced by \f(CW\*(C`list()\*(C'\fR .Sp Parameters are .RS 4 .ie n .IP "$lis" 4 .el .IP "\f(CW$lis\fR" 4 .IX Item "$lis" Reference to a list produced by \f(CW\*(C`list()\*(C'\fR .ie n .IP "$sortMode" 4 .el .IP "\f(CW$sortMode\fR" 4 .IX Item "$sortMode" Sorting rules. .RE .RS 4 .Sp Return value is similar to \f(CW\*(C`list()\*(C'\fR .RE .SS "\s-1EXPORT\s0" .IX Subsection "EXPORT" None by default .SH "SEE ALSO" .IX Header "SEE ALSO" DirHandle, stat, lstat, sort .SH "AUTHOR" .IX Header "AUTHOR" Daniel Podolsky, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2006 by Daniel Podolsky, .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.