1Archive::Any::Plugin(3)User Contributed Perl DocumentatioAnrchive::Any::Plugin(3)
2
3
4

NAME

6       Archive::Any::Plugin - Anatomy of an Archive::Any plugin.
7

SYNOPSIS

9       Explains what is required for a working plugin to Archive::Any.
10

PLUGINS

12       Archive::Any requires that your plugin define three methods, all of
13       which are passed the absolute filename of the file.  This module uses
14       the source of Archive::Any::Plugin::Tar as an example.
15
16       Subclass Archive::Any::Plugin
17            use base 'Archive::Any::Plugin';
18
19       can_handle
20           This returns an array of mime types that the plugin can handle.
21
22            sub can_handle {
23               return(
24                      'application/x-tar',
25                      'application/x-gtar',
26                      'application/x-gzip',
27                     );
28            }
29
30       files
31           Return a list of items inside the archive.
32
33            sub files {
34               my( $self, $file ) = @_;
35               my $t = Archive::Tar->new( $file );
36               return $t->list_files;
37            }
38
39       extract
40           This method should extract the contents of $file to the current
41           directory.  Archive::Any::Plugin handles negotiating directories
42           for you.
43
44            sub extract {
45               my ( $self, $file ) = @_;
46
47               my $t = Archive::Tar->new( $file );
48               return $t->extract;
49            }
50

AUTHOR

52       Clint Moore <cmoore@cpan.org>
53

SEE ALSO

55       Archive::Any
56
57
58
59perl v5.8.8                       2007-05-09           Archive::Any::Plugin(3)
Impressum