NAME

File::Stat::Ls - Perl class for converting stat to ls -l format

SYNOPSIS

use File::Stat::Ls;

my $obj = File::Stat::Ls->new;
my @a = statstat('/file/name.txt'); 
my $ls = $obj->ls_stat(@a);

DESCRIPTION

This class contains methods to convert stat elements into ls format. It exports two methods: format_mode and ls_stat. The format_mode is borrowed from Stat::lsMode class by Mark_Jason Dominus. The ls_stat will build a string formated as the output of 'ls -l'.

new ()

Input variables:

None

Variables used or routines called:

None

How to use:

my $obj = new File::Stat::Ls;      # or
my $obj = File::Stat::Ls->new;     # or

Return: new empty or initialized File::Stat::Ls object.

METHODS

This class defines the following common methods, routines, and functions.

Exported Tag: All

The :all tag includes all the methods or sub-rountines defined in this class.

use File::Stat::Ls qw(:all);

It includes the following sub-routines:

format_mode ($mode)

Input variables:

$mode - the third element from stat

Variables used or routines called:

None

How to use:

my $md = $self->format_mode((stat $fn)[2]);

Return: string with permission bits such as -r-xr-xr-x.

ls_stat ($fn)

Input variables:

$fn - file name
   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
    $atime,$mtime,$ctime,$blksize,$blocks) = stat($fn);

Variables used or routines called:

None

How to use:

my $ls = $self->ls_stat($fn);

Return: the ls string such as one of the followings:

-r-xr-xr-x   1 root     other         4523 Jul 12 09:49 uniq
drwxr-xr-x   2 root     other       2048 Jul 12 09:50 bin
lrwxrwxrwx   1 oracle7  dba           40 Jun 12  2002 linked.pl 
             -> /opt/bin/linked2.pl

HISTORY

  • Version 0.10

    This version includes two methods: format_mode and ls_stat.

SEE ALSO (some of docs that I check often)

Data::Describe, Oracle::Loader, CGI::Getopt, File::Xcopy, Oracle::Trigger, Debug::EchoMessage, CGI::Getopt, etc.

AUTHOR

Copyright (c) 2005 Hanming Tu. All rights reserved.

This package is free software and is provided "as is" without express or implied warranty. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 209:

You forgot a '=back' before '=head1'