Data-CTable
view release on metacpan or search on metacpan
CTable/Listing.pm view on Meta::CPAN
Dir Directory component of Path
Base Base component of file name (without the Ext)
Ext Extension (any non-. characters after last . plus the . itself)
Other derived fields (see --fields, --all, or --derived):
File Filename component of Path (= Base + Ext)
Type File or directory
Perms Permissions (from Mode), specified as an octal string
Owner Unix owner name: getpwuid(UID) (empty on Win)
Group Unix owner name: getgrgid(GID) (empty on Win)
Mon TMon + 1 (range 1 to 12)
Year TYear + 1900 (range 1900 to 2038)
RTime ModTime as human-readable string (localtime(MTIME)."")
Stamp String-sortable semi-numeric time stamp (based on MTIME)
Field names are always built and output using mixed-case as indicated.
CTable/Listing.pm view on Meta::CPAN
$t->col(File => $t->calc(sub{"$main::Base$main::Ext"}));
$t->col(Type => $t->calc(sub{-d $main::Path ? "D" : "F"}));
## Add a Perms field showing permission component of (stat)[2]
## formatted as a 4-digit octal number.
$t->col(Perms => [map {sprintf("%04o", $_ & 0777)} @{$t->col('Mode')}]);
## Add columns translating the UID and GID into their string form.
$t->col(Owner => [map {((eval{getpwuid($_)})[0]) } @{$t->col('UID' )}]);
$t->col(Group => [map {((eval{getgrgid($_)})[0]) } @{$t->col('GID' )}]);
## Add a column showing the full file name.
$t->col(Mon => $t->calc(sub{$main::TMon + 1}));
$t->col(Year => $t->calc(sub{$main::TYear + 1900}));
## Add some time stamps -- one human-readable and one computer-sortable.
$t->col(RTime => $t->calc(sub{localtime($main::MTime).""}));
use POSIX;
$t->col(Stamp => $t->calc(sub{strftime("%Y%m%d%H%M%S", localtime($main::MTime))}));
( run in 0.269 second using v1.01-cache-2.11-cpan-8d75d55dd25 )