$OpenBSD: OpenBSD::Ustar.pod,v 1.1 2005/02/28 13:08:41 espie Exp $ =head1 NAME OpenBSD::Ustar - simple access to Ustar C archives =head1 SYNOPSIS use OpenBSD::Ustar; open(my $fh, "<", $filename); $arc = OpenBSD::Ustar->new($fh, $destdir); while (my $o = $arc->next()) { # decide whether we want to extract it, change object attributes $o->create(); } =head1 DESCRIPTION C provides an API to read archives created by C. For the time being, it can only handle the USTAR archive format. Most client software will specialize C to their own needs. Note however that C is not designed for inheritance. Composition (putting a C object inside your class) and forwarding methods (writing C or C methods that call the C method) are the correct way to use this API. A filehandle C<$fh> is associated with an C object through C. The filehandle should support C. C does not rely on C or C in order to be usable on pipe outputs. On the other hand, C does not do any caching. The client code is responsible for retrieving and storing archives if it needs to scan through them multiple times in a row. Access to the archive object C<$arc> occurs through a loop that repeatedly calls C<$o = $arc-Enext()> to obtain the next archive entry. It returns an archive entry object C<$o> that can be queried to decide whether to extract this entry or not. Actual extraction is performed through C<$o-Eextract()> and is not mandatory. Thus, client code can control whether it wants to extract archive elements or not. Client code may decide to abort archive extraction early, or to run it through until C<$arc-Enext()> returns false. The C object doesn't hold any resources and doesn't need any specific clean-up. However, client code is responsible for closing the filehandle and terminating any associated pipe process. An object C<$o> returned through C holds all the characteristics of the archive header: =over 20 =item C<$o-EIsDir()> true if archive entry is a directory =item C<$o-EIsFile()> true if archive entry is a file =item C<$o-EIsLink()> true if archive entry is any kind of link =item C<$o-EIsSymLink()> true if archive entry is a symbolic link =item C<$o-EIsHardLink()> true if archive entry is a hard link =item C<$o-E{name}> filename =item C<$o-E{mode}> C mode =item C<$o-E{mtime}> C modification time =item C<$o-E{uid}> owner user ID =item C<$o-E{gid}> owner group ID =item C<$o-E{uname}> owner user name =item C<$o-E{gname}> owner group name =item C<$o-E{linkname}> name of the source link, if applicable =back The fields C, C, C, C, C and C can be altered before calling C<$o-Ecreate()>, and will properly influence the resulting file. The relationship between C and C, and C and C conforms to the USTAR format usual behavior. In addition, client code may define C<$o-E{cwd}> in a way similar to C's C<-C> option to affect the creation of hard links. All creation commands happen relative to the C<$destdir> that was used for creating the C<$arc> C object.