logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Authors

       •   Clint Moore

       •   Michael G Schwern (author emeritus)

       •   Olaf Alders (current maintainer)

Name

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

Plugins

       Archive::Any requires that your plugin define three methods, all of which are passed the absolute
       filename of the file.  This module uses the source of Archive::Any::Plugin::Tar as an example.

       SubclassArchive::Any::Plugin
            use base 'Archive::Any::Plugin';

       can_handle
           This returns an array of mime types that the plugin can handle.

            sub can_handle {
               return(
                      'application/x-tar',
                      'application/x-gtar',
                      'application/x-gzip',
                     );
            }

       files
           Return a list of items inside the archive.

            sub files {
               my( $self, $file ) = @_;
               my $t = Archive::Tar->new( $file );
               return $t->list_files;
            }

       extract
           This  method  should  extract  the  contents of $file to the current directory.  Archive::Any::Plugin
           handles negotiating directories for you.

            sub extract {
               my ( $self, $file ) = @_;

               my $t = Archive::Tar->new( $file );
               return $t->extract;
            }

See Also

       Archive::Any

Synopsis

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

Version

       version 0.0946

See Also