leo charre


LEOCHARRE::Dir released

I’m not quite tired of rewriting opendir and list contents and which are files and directories, etc.
I just think it was time I did this for myself.

It’s a module with some subs to do things like, get all abs paths to files in dir x- simply by coding lsfa('./');

Here’s the manual to LEOCHARRE::Dir..

LEOCHARRE::Dir(3)     User Contributed Perl Documentation    LEOCHARRE::Dir(3)

NAME
       LEOCHARRE::Dir - subs for dirs

SYNOPSIS
          use LEOCHARRE::Dir ’:all’;

          my $dir = reqdir("./dirhere");

          my @ls = ls($dir);

          my @files = lsf($dir);

          my @dirs = lsd($dir);

          my @abs_dirs = lsda($dir);

          my @abs_files = lsfa($dir);

          my @abs_all = lsa($dir);

DESCRIPTION
       Reading directories, etc.

SUBS
       None are exported by default.

       ls()

       Argument is path to dir.  Returns list array with all files, including dirs files and
       symlinks, etc.

       lsa()

       Same as ls(), but paths are absolute.

       lsf()

       Argument is path to dir.  Returns list array with all files.

       lsfa()

       Same as lsf(), but paths are absolute.

       lsd()

       Argument is path to dir.  Returns list array with all dirs.

       lsda()

       Same as lsd(), but paths are absolute.

       lsr()

       Argument is path to dir.  Returns paths relative to ENV DOCUMENT ROOT.  Slash at front
       is included.  ENV DOCUMENT ROOT must be set or dies.  If none in list, returns undef;
       If it is not within ENV DOCUMENT ROOT, returns undef.  This uses Cwd::abs_path thus it
       resolves symlinks, this cgi-bin may not be within DOCUMENT ROOT, note.  Returns array
       list.

       lsfr()

       Like lsr() but returns files.

       lsdr()

       Like lsr() but returns dirs.

       reqdir()

       Argument is path to dir.  Requires that the dir exist, if not there, creates.  Returns
       abs path to dir requested.

SEE ALSO
       Cwd

AUTHOR
       Leo Charre leocharre at cpan dot org

perl v5.8.8                       2008-07-15                 LEOCHARRE::Dir(3)

Leave a Reply


Linux User