| 1 | package File::ArchivableFormats::Plugin; | ||||||||||
| 2 | 5 | our $VERSION = '1.8'; | |||||||||
| 3 | 5 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 5 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | # ABSTRACT: Role which implements logic for all plugins | ||||||||||
| 7 | |||||||||||
| 8 | 5 | requires '_build_preferred_formats'; | |||||||||
| 9 | |||||||||||
| 10 | 5 | has preferred_formats => ( | |||||||||
| 11 | is => 'ro', | ||||||||||
| 12 | isa => 'HashRef', | ||||||||||
| 13 | traits => ['Hash'], | ||||||||||
| 14 | lazy => 1, | ||||||||||
| 15 | builder => '_build_preferred_formats', | ||||||||||
| 16 | handles => { | ||||||||||
| 17 | is_archivable => 'defined', | ||||||||||
| 18 | get_info => 'get', | ||||||||||
| 19 | |||||||||||
| 20 | } | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | 5 | has name => ( | |||||||||
| 24 | is => 'ro', | ||||||||||
| 25 | isa => 'Str', | ||||||||||
| 26 | required => 1, | ||||||||||
| 27 | ); | ||||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | sub _not_allowed { | ||||||||
|
Subroutine
_not_allowed: not called CC=1 SCAR=6.9
| |||||||||||
| 30 | 0 | my $self = shift; | |||||||||
| 31 | 0 | return { types => [], allowed_extensions => [] }; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 2 | ▶ | sub allowed_extensions { | ||||||||
|
Subroutine
allowed_extensions: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 35 | 2 | my ($self, $mimetype) = @_; | |||||||||
| 36 | |||||||||||
| 37 | 2 | ▶ | if ($self->is_archivable($mimetype)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 2 | return $self->get_info($mimetype); | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | return $self->_not_allowed; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 5 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||