Skip Menu |

This queue is for tickets about the Archive-Tar CPAN distribution.

Report information
The Basics
Id: 15935
Status: resolved
Priority: 0/
Queue: Archive-Tar

People
Owner: Nobody in particular
Requestors: chris [...] ex-parrot.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.26
Fixed in: (no value)



Subject: File type constants are not documented
The file type constants in Archive::Tar::Constants are not documented, despite a reference in the Archive::Tar::File POD to their being an explanation in Archive::Tar. Further, 'type' is not mentioned as one of the fields which may be passed to Archive::Tar->add_data(). The attached patch corrects this. Also, a function for generating the appropriate type constants from the mode bits would be useful. Something like this: # file_type_tar MODE # Return the tar file type for a file with the given MODE bits. sub file_type_tar ($) { my $m = shift; if (S_ISDIR($m)) { return Archive::Tar::Constant::DIR; } elsif (S_ISREG($m)) { return Archive::Tar::Constant::FILE; } elsif (S_ISLNK($m)) { return Archive::Tar::Constant::SYMLINK; } elsif (S_ISFIFO($m)) { return Archive::Tar::Constant::FIFO; } elsif (S_ISCHR($m)) { return Archive::Tar::Constant::CHARDEV; } elsif (S_ISBLK($m)) { return Archive::Tar::Constant::BLOCKDEV; } }
--- Tar.pm.orig Fri Nov 18 18:10:56 2005 +++ Tar.pm Fri Nov 18 18:13:43 2005 @@ -1101,9 +1101,45 @@ content C<$data>. Specific properties can be set using C<$opthashref>. The following list of properties is supported: name, size, mtime (last modified date), mode, uid, gid, linkname, uname, gname, -devmajor, devminor, prefix. (On MacOS, the file's path and +devmajor, devminor, prefix, type. (On MacOS, the file's path and modification times are converted to Unix equivalents.) +Valid values for the file type are the following constants defined in +Archive::Tar::Constants: + +=over 4 + +=item FILE + +Regular file. + +=item HARDLINK + +=item SYMLINK + +Hard and symbolic ("soft") links; linkname should specify target. + +=item CHARDEV + +=item BLOCKDEV + +Character and block devices. devmajor and devminor should specify the major +and minor device numbers. + +=item DIR + +Directory. + +=item FIFO + +FIFO (named pipe). + +=item SOCKET + +Socket. + +=back + Returns the C<Archive::Tar::File> object that was just added, or C<undef> on failure.
On Fri Nov 18 13:15:46 2005, guest wrote: Show quoted text
> The file type constants in Archive::Tar::Constants are not documented,
Show quoted text
> The attached patch corrects this.
Thanks, applied as 12366