# PaCkAgE DaTaStReAm
LNFfile-listing-512 1 93
# end of header
07070100030b19000081a400001782000005de0000000155add59e000001f00000025c00000b4700000000000000000000001c00000000LNFfile-listing-512/pkginfo CLASSES=none rename
PSTAMP=q20150721071614
LICFILE=pal2.txt
LICURL=http://www.perlfoundation.org/artistic_license_2_0
LICINFO=Perl Artistic License 2.0
DESC=The File::Listing module exports a single function called parse_dir(), which can be used to parse directory listings.
BASEDIR=/usr
VENDOR=LINOFEE, http://www.linofee.org
EMAIL=developers@linofee.org
CATEGORY=develop,utils,application
NAME=File::Listing - parse directory listing
SERIALNUM=001
VERSION=6.4
ARCH=i386
PKG=LNFfile-listing-512
07070100030b18000081a400001782000005de0000000155add59e000003860000025c00000b4700000000000000000000001b00000000LNFfile-listing-512/pkgmap : 1 93
1 i copyright 33 2357 1437450516
1 i depend 159 12903 1437451912
1 i i.rename 313 24364 1426618113
1 d none perl5 ? ? ?
1 d none perl5/5.12 ? ? ?
1 d none perl5/5.12/man ? ? ?
1 d none perl5/5.12/man/man3 ? ? ?
1 f none perl5/5.12/man/man3/File::Listing.3 0444 root bin 6248 23760 1437451546
1 d none perl5/site_perl ? ? ?
1 d none perl5/site_perl/5.12 ? ? ?
1 d none perl5/site_perl/5.12/File ? ? ?
1 f none perl5/site_perl/5.12/File/Listing.pm 0444 root bin 10630 56530 1329343301
1 d none perl5/site_perl/5.12/i86pc-solaris-64int ? ? ?
1 d none perl5/site_perl/5.12/i86pc-solaris-64int/auto ? ? ?
1 d none perl5/site_perl/5.12/i86pc-solaris-64int/auto/File ? ? ?
1 d none perl5/site_perl/5.12/i86pc-solaris-64int/auto/File/Listing 0755 root bin
1 f rename perl5/site_perl/5.12/i86pc-solaris-64int/auto/File/Listing/.packlist 0644 root bin 107 8572 1437455774
1 i pkginfo 496 42318 1437455774
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!! 07070100030b19000081a400001782000005de0000000155add59e000001f00000025c00000b4700000000000000000000000800000000pkginfo CLASSES=none rename
PSTAMP=q20150721071614
LICFILE=pal2.txt
LICURL=http://www.perlfoundation.org/artistic_license_2_0
LICINFO=Perl Artistic License 2.0
DESC=The File::Listing module exports a single function called parse_dir(), which can be used to parse directory listings.
BASEDIR=/usr
VENDOR=LINOFEE, http://www.linofee.org
EMAIL=developers@linofee.org
CATEGORY=develop,utils,application
NAME=File::Listing - parse directory listing
SERIALNUM=001
VERSION=6.4
ARCH=i386
PKG=LNFfile-listing-512
07070100030b18000081a400001782000005de0000000155add59e000003860000025c00000b4700000000000000000000000700000000pkgmap : 1 93
1 i copyright 33 2357 1437450516
1 i depend 159 12903 1437451912
1 i i.rename 313 24364 1426618113
1 d none perl5 ? ? ?
1 d none perl5/5.12 ? ? ?
1 d none perl5/5.12/man ? ? ?
1 d none perl5/5.12/man/man3 ? ? ?
1 f none perl5/5.12/man/man3/File::Listing.3 0444 root bin 6248 23760 1437451546
1 d none perl5/site_perl ? ? ?
1 d none perl5/site_perl/5.12 ? ? ?
1 d none perl5/site_perl/5.12/File ? ? ?
1 f none perl5/site_perl/5.12/File/Listing.pm 0444 root bin 10630 56530 1329343301
1 d none perl5/site_perl/5.12/i86pc-solaris-64int ? ? ?
1 d none perl5/site_perl/5.12/i86pc-solaris-64int/auto ? ? ?
1 d none perl5/site_perl/5.12/i86pc-solaris-64int/auto/File ? ? ?
1 d none perl5/site_perl/5.12/i86pc-solaris-64int/auto/File/Listing 0755 root bin
1 f rename perl5/site_perl/5.12/i86pc-solaris-64int/auto/File/Listing/.packlist 0644 root bin 107 8572 1437455774
1 i pkginfo 496 42318 1437455774
07070100030b1a000041ed00001782000005de0000000255add59f000000000000025c00000b4700000000000000000000000800000000install 07070100030b1c000081a400001782000005de0000000155adc6880000009f0000025c00000b4700000000000000000000000f00000000install/depend P LNFhttp-date-512 HTTP::Date - Perl date conversion routines
# missing legacy info
#P SUNWperl512core Perl 5.12 (core)
#P SUNWperl512usr Perl 5.12 (non-core)
07070100030b1b000081a400001782000005de0000000155adc114000000210000025c00000b4700000000000000000000001200000000install/copyright
Copyright 1996-2010, Gisle Aas
07070100030b1d000081a400001782000005de0000000155087701000001390000025c00000b4700000000000000000000001100000000install/i.rename # substitute the build path with the install path
while read src dst
do
sed -e "s#@CLIENT_BASEDIR@#$CLIENT_BASEDIR#g" $src > $dst || exit 2
# removef $PKGINST $dst
# installf -c rename $PKGINST $dst
done
#if [ "$1" = ENDOFCLASS ]; then
# removef -f -c rename $PKGINST
# installf -f -c rename $PKGINST
#fi
exit 0
07070100030b1e000041ed00001782000005de0000000355add59f000000000000025c00000b4700000000000000000000000600000000reloc 07070100030b1f000041ed00001782000005de0000000455add59f000000000000025c00000b4700000000000000000000000c00000000reloc/perl5 07070100030b24000041ed00001782000005de0000000355add59f000000000000025c00000b4700000000000000000000001600000000reloc/perl5/site_perl 07070100030b25000041ed00001782000005de0000000455add59f000000000000025c00000b4700000000000000000000001b00000000reloc/perl5/site_perl/5.12 07070100030b26000041ed00001782000005de0000000255add59f000000000000025c00000b4700000000000000000000002000000000reloc/perl5/site_perl/5.12/File 07070100030b27000081a400001782000005de000000014f3c2b45000029860000025c00000b4700000000000000000000002b00000000reloc/perl5/site_perl/5.12/File/Listing.pm package File::Listing;
sub Version { $VERSION; }
$VERSION = "6.04";
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(parse_dir);
use strict;
use Carp ();
use HTTP::Date qw(str2time);
sub parse_dir ($;$$$)
{
my($dir, $tz, $fstype, $error) = @_;
$fstype ||= 'unix';
$fstype = "File::Listing::" . lc $fstype;
my @args = $_[0];
push(@args, $tz) if(@_ >= 2);
push(@args, $error) if(@_ >= 4);
$fstype->parse(@args);
}
sub line { Carp::croak("Not implemented yet"); }
sub init { } # Dummy sub
sub file_mode ($)
{
Carp::croak("Input to file_mode() must be a 10 character string.")
unless length($_[0]) == 10;
# This routine was originally borrowed from Graham Barr's
# Net::FTP package.
local $_ = shift;
my $mode = 0;
my($type);
s/^(.)// and $type = $1;
# When the set-group-ID bit (file mode bit 02000) is set, and the group
# execution bit (file mode bit 00020) is unset, and it is a regular file,
# some implementations of `ls' use the letter `S', others use `l' or `L'.
# Convert this `S'.
s/[Ll](...)$/S$1/;
while (/(.)/g) {
$mode <<= 1;
$mode |= 1 if $1 ne "-" &&
$1 ne 'S' &&
$1 ne 'T';
}
$mode |= 0004000 if /^..s....../i;
$mode |= 0002000 if /^.....s.../i;
$mode |= 0001000 if /^........t/i;
# De facto standard definitions. From 'stat.h' on Solaris 9.
$type eq "p" and $mode |= 0010000 or # fifo
$type eq "c" and $mode |= 0020000 or # character special
$type eq "d" and $mode |= 0040000 or # directory
$type eq "b" and $mode |= 0060000 or # block special
$type eq "-" and $mode |= 0100000 or # regular
$type eq "l" and $mode |= 0120000 or # symbolic link
$type eq "s" and $mode |= 0140000 or # socket
$type eq "D" and $mode |= 0150000 or # door
Carp::croak("Unknown file type: $type");
$mode;
}
sub parse
{
my($pkg, $dir, $tz, $error) = @_;
# First let's try to determine what kind of dir parameter we have
# received. We allow both listings, reference to arrays and
# file handles to read from.
if (ref($dir) eq 'ARRAY') {
# Already splitted up
}
elsif (ref($dir) eq 'GLOB') {
# A file handle
}
elsif (ref($dir)) {
Carp::croak("Illegal argument to parse_dir()");
}
elsif ($dir =~ /^\*\w+(::\w+)+$/) {
# This scalar looks like a file handle, so we assume it is
}
else {
# A normal scalar listing
$dir = [ split(/\n/, $dir) ];
}
$pkg->init();
my @files = ();
if (ref($dir) eq 'ARRAY') {
for (@$dir) {
push(@files, $pkg->line($_, $tz, $error));
}
}
else {
local($_);
while (<$dir>) {
chomp;
push(@files, $pkg->line($_, $tz, $error));
}
}
wantarray ? @files : \@files;
}
package File::Listing::unix;
use HTTP::Date qw(str2time);
# A place to remember current directory from last line parsed.
use vars qw($curdir @ISA);
@ISA = qw(File::Listing);
sub init
{
$curdir = '';
}
sub line
{
shift; # package name
local($_) = shift;
my($tz, $error) = @_;
s/\015//g;
#study;
my ($kind, $size, $date, $name);
if (($kind, $size, $date, $name) =
/^([\-FlrwxsStTdD]{10}) # Type and permission bits
.* # Graps
\D(\d+) # File size
\s+ # Some space
(\w{3}\s+\d+\s+(?:\d{1,2}:\d{2}|\d{4})|\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}) # Date
\s+ # Some more space
(.*)$ # File name
/x )
{
return if $name eq '.' || $name eq '..';
$name = "$curdir/$name" if length $curdir;
my $type = '?';
if ($kind =~ /^l/ && $name =~ /(.*) -> (.*)/ ) {
$name = $1;
$type = "l $2";
}
elsif ($kind =~ /^[\-F]/) { # (hopefully) a regular file
$type = 'f';
}
elsif ($kind =~ /^[dD]/) {
$type = 'd';
$size = undef; # Don't believe the reported size
}
return [$name, $type, $size, str2time($date, $tz),
File::Listing::file_mode($kind)];
}
elsif (/^(.+):$/ && !/^[dcbsp].*\s.*\s.*:$/ ) {
my $dir = $1;
return () if $dir eq '.';
$curdir = $dir;
return ();
}
elsif (/^[Tt]otal\s+(\d+)$/ || /^\s*$/) {
return ();
}
elsif (/not found/ || # OSF1, HPUX, and SunOS return
# "$file not found"
/No such file/ || # IRIX returns
# "UX:ls: ERROR: Cannot access $file: No such file or directory"
# Solaris returns
# "$file: No such file or directory"
/cannot find/ # Windows NT returns
# "The system cannot find the path specified."
) {
return () unless defined $error;
&$error($_) if ref($error) eq 'CODE';
warn "Error: $_\n" if $error eq 'warn';
return ();
}
elsif ($_ eq '') { # AIX, and Linux return nothing
return () unless defined $error;
&$error("No such file or directory") if ref($error) eq 'CODE';
warn "Warning: No such file or directory\n" if $error eq 'warn';
return ();
}
else {
# parse failed, check if the dosftp parse understands it
File::Listing::dosftp->init();
return(File::Listing::dosftp->line($_,$tz,$error));
}
}
package File::Listing::dosftp;
use HTTP::Date qw(str2time);
# A place to remember current directory from last line parsed.
use vars qw($curdir @ISA);
@ISA = qw(File::Listing);
sub init
{
$curdir = '';
}
sub line
{
shift; # package name
local($_) = shift;
my($tz, $error) = @_;
s/\015//g;
my ($date, $size_or_dir, $name, $size);
# 02-05-96 10:48AM 1415 src.slf
# 09-10-96 09:18AM
sl_util
if (($date, $size_or_dir, $name) =
/^(\d\d-\d\d-\d\d\s+\d\d:\d\d\wM) # Date and time info
\s+ # Some space
(<\w{3}>|\d+) # Dir or Size
\s+ # Some more space
(.+)$ # File name
/x )
{
return if $name eq '.' || $name eq '..';
$name = "$curdir/$name" if length $curdir;
my $type = '?';
if ($size_or_dir eq '') {
$type = "d";
$size = ""; # directories have no size in the pc listing
}
else {
$type = 'f';
$size = $size_or_dir;
}
return [$name, $type, $size, str2time($date, $tz), undef];
}
else {
return () unless defined $error;
&$error($_) if ref($error) eq 'CODE';
warn "Can't parse: $_\n" if $error eq 'warn';
return ();
}
}
package File::Listing::vms;
@File::Listing::vms::ISA = qw(File::Listing);
package File::Listing::netware;
@File::Listing::netware::ISA = qw(File::Listing);
package File::Listing::apache;
use vars qw(@ISA);
@ISA = qw(File::Listing);
sub init { }
sub line {
shift; # package name
local($_) = shift;
my($tz, $error) = @_; # ignored for now...
s!?t[rd][^>]*>! !g; # clean away various table stuff
if (m!.*.*?(\d+)-([a-zA-Z]+|\d+)-(\d+)\s+(\d+):(\d+)\s+(?:([\d\.]+[kMG]?|-))!i) {
my($filename, $filesize) = ($1, $7);
my($d,$m,$y, $H,$M) = ($2,$3,$4,$5,$6);
if ($m =~ /^\d+$/) {
($d,$y) = ($y,$d) # iso date
}
else {
$m = _monthabbrev_number($m);
}
$filesize = 0 if $filesize eq '-';
if ($filesize =~ s/k$//i) {
$filesize *= 1024;
}
elsif ($filesize =~ s/M$//) {
$filesize *= 1024*1024;
}
elsif ($filesize =~ s/G$//) {
$filesize *= 1024*1024*1024;
}
$filesize = int $filesize;
require Time::Local;
my $filetime = Time::Local::timelocal(0,$M,$H,$d,$m-1,_guess_year($y)-1900);
my $filetype = ($filename =~ s|/$|| ? "d" : "f");
return [$filename, $filetype, $filesize, $filetime, undef];
}
return ();
}
sub _guess_year {
my $y = shift;
if ($y >= 90) {
$y = 1900+$y;
}
elsif ($y < 100) {
$y = 2000+$y;
}
$y;
}
sub _monthabbrev_number {
my $mon = shift;
+{'Jan' => 1,
'Feb' => 2,
'Mar' => 3,
'Apr' => 4,
'May' => 5,
'Jun' => 6,
'Jul' => 7,
'Aug' => 8,
'Sep' => 9,
'Oct' => 10,
'Nov' => 11,
'Dec' => 12,
}->{$mon};
}
1;
__END__
=head1 NAME
File::Listing - parse directory listing
=head1 SYNOPSIS
use File::Listing qw(parse_dir);
$ENV{LANG} = "C"; # dates in non-English locales not supported
for (parse_dir(`ls -l`)) {
($name, $type, $size, $mtime, $mode) = @$_;
next if $type ne 'f'; # plain file
#...
}
# directory listing can also be read from a file
open(LISTING, "zcat ls-lR.gz|");
$dir = parse_dir(\*LISTING, '+0000');
=head1 DESCRIPTION
This module exports a single function called parse_dir(), which can be
used to parse directory listings.
The first parameter to parse_dir() is the directory listing to parse.
It can be a scalar, a reference to an array of directory lines or a
glob representing a filehandle to read the directory listing from.
The second parameter is the time zone to use when parsing time stamps
in the listing. If this value is undefined, then the local time zone is
assumed.
The third parameter is the type of listing to assume. Currently
supported formats are 'unix', 'apache' and 'dosftp'. The default
value is 'unix'. Ideally, the listing type should be determined
automatically.
The fourth parameter specifies how unparseable lines should be treated.
Values can be 'ignore', 'warn' or a code reference. Warn means that
the perl warn() function will be called. If a code reference is
passed, then this routine will be called and the return value from it
will be incorporated in the listing. The default is 'ignore'.
Only the first parameter is mandatory.
The return value from parse_dir() is a list of directory entries. In
a scalar context the return value is a reference to the list. The
directory entries are represented by an array consisting of [
$filename, $filetype, $filesize, $filetime, $filemode ]. The
$filetype value is one of the letters 'f', 'd', 'l' or '?'. The
$filetime value is the seconds since Jan 1, 1970. The
$filemode is a bitmask like the mode returned by stat().
=head1 COPYRIGHT
Copyright 1996-2010, Gisle Aas
Based on lsparse.pl (from Lee McLoughlin's ftp mirror package) and
Net::FTP's parse_dir (Graham Barr).
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
07070100030b28000041ed00001782000005de0000000355add59f000000000000025c00000b4700000000000000000000002f00000000reloc/perl5/site_perl/5.12/i86pc-solaris-64int 07070100030b29000041ed00001782000005de0000000355add59f000000000000025c00000b4700000000000000000000003400000000reloc/perl5/site_perl/5.12/i86pc-solaris-64int/auto 07070100030b2a000041ed00001782000005de0000000355add59f000000000000025c00000b4700000000000000000000003900000000reloc/perl5/site_perl/5.12/i86pc-solaris-64int/auto/File 07070100030b2b000041ed00001782000005de0000000255add59f000000000000025c00000b4700000000000000000000004100000000reloc/perl5/site_perl/5.12/i86pc-solaris-64int/auto/File/Listing 07070100030b2c000081a400001782000005de0000000155add59e0000006b0000025c00000b4700000000000000000000004b00000000reloc/perl5/site_perl/5.12/i86pc-solaris-64int/auto/File/Listing/.packlist @CLIENT_BASEDIR@/perl5/5.12/man/man3/File::Listing.3
@CLIENT_BASEDIR@/perl5/site_perl/5.12/File/Listing.pm
07070100030b20000041ed00001782000005de0000000355add59f000000000000025c00000b4700000000000000000000001100000000reloc/perl5/5.12 07070100030b21000041ed00001782000005de0000000355add59f000000000000025c00000b4700000000000000000000001500000000reloc/perl5/5.12/man 07070100030b22000041ed00001782000005de0000000255add59f000000000000025c00000b4700000000000000000000001a00000000reloc/perl5/5.12/man/man3 07070100030b23000081a400001782000005de0000000155adc51a000018680000025c00000b4700000000000000000000002a00000000reloc/perl5/5.12/man/man3/File::Listing.3 .\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "File::Listing 3"
.TH File::Listing 3 "2012-02-15" "perl v5.12.5" "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::Listing \- parse directory listing
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 7
\& use File::Listing qw(parse_dir);
\& $ENV{LANG} = "C"; # dates in non\-English locales not supported
\& for (parse_dir(\`ls \-l\`)) {
\& ($name, $type, $size, $mtime, $mode) = @$_;
\& next if $type ne \*(Aqf\*(Aq; # plain file
\& #...
\& }
\&
\& # directory listing can also be read from a file
\& open(LISTING, "zcat ls\-lR.gz|");
\& $dir = parse_dir(\e*LISTING, \*(Aq+0000\*(Aq);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module exports a single function called \fIparse_dir()\fR, which can be
used to parse directory listings.
.PP
The first parameter to \fIparse_dir()\fR is the directory listing to parse.
It can be a scalar, a reference to an array of directory lines or a
glob representing a filehandle to read the directory listing from.
.PP
The second parameter is the time zone to use when parsing time stamps
in the listing. If this value is undefined, then the local time zone is
assumed.
.PP
The third parameter is the type of listing to assume. Currently
supported formats are 'unix', 'apache' and 'dosftp'. The default
value is 'unix'. Ideally, the listing type should be determined
automatically.
.PP
The fourth parameter specifies how unparseable lines should be treated.
Values can be 'ignore', 'warn' or a code reference. Warn means that
the perl \fIwarn()\fR function will be called. If a code reference is
passed, then this routine will be called and the return value from it
will be incorporated in the listing. The default is 'ignore'.
.PP
Only the first parameter is mandatory.
.PP
The return value from \fIparse_dir()\fR is a list of directory entries. In
a scalar context the return value is a reference to the list. The
directory entries are represented by an array consisting of [
\&\f(CW$filename\fR, \f(CW$filetype\fR, \f(CW$filesize\fR, \f(CW$filetime\fR, \f(CW$filemode\fR ]. The
\&\f(CW$filetype\fR value is one of the letters 'f', 'd', 'l' or '?'. The
\&\f(CW$filetime\fR value is the seconds since Jan 1, 1970. The
\&\f(CW$filemode\fR is a bitmask like the mode returned by \fIstat()\fR.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 1996\-2010, Gisle Aas
.PP
Based on lsparse.pl (from Lee McLoughlin's ftp mirror package) and
Net::FTP's parse_dir (Graham Barr).
.PP
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!