1Archive::Any::Plugin(3)User Contributed Perl DocumentatioAnrchive::Any::Plugin(3)
2
3
4
6 Archive::Any::Plugin - Anatomy of an Archive::Any plugin.
7
9 version 0.0946
10
12 Explains what is required for a working plugin to Archive::Any.
13
15 Archive::Any requires that your plugin define three methods, all of
16 which are passed the absolute filename of the file. This module uses
17 the source of Archive::Any::Plugin::Tar as an example.
18
19 Subclass Archive::Any::Plugin
20 use base 'Archive::Any::Plugin';
21
22 can_handle
23 This returns an array of mime types that the plugin can handle.
24
25 sub can_handle {
26 return(
27 'application/x-tar',
28 'application/x-gtar',
29 'application/x-gzip',
30 );
31 }
32
33 files
34 Return a list of items inside the archive.
35
36 sub files {
37 my( $self, $file ) = @_;
38 my $t = Archive::Tar->new( $file );
39 return $t->list_files;
40 }
41
42 extract
43 This method should extract the contents of $file to the current
44 directory. Archive::Any::Plugin handles negotiating directories
45 for you.
46
47 sub extract {
48 my ( $self, $file ) = @_;
49
50 my $t = Archive::Tar->new( $file );
51 return $t->extract;
52 }
53
55 Archive::Any
56
58 · Clint Moore
59
60 · Michael G Schwern (author emeritus)
61
62 · Olaf Alders (current maintainer)
63
65 This software is copyright (c) 2016 by Michael G Schwern, Clint Moore,
66 Olaf Alders.
67
68 This is free software; you can redistribute it and/or modify it under
69 the same terms as the Perl 5 programming language system itself.
70
71
72
73perl v5.30.1 2020-01-29 Archive::Any::Plugin(3)