| 1 | ## no critic (ControlStructures::ProhibitPostfixControls) | ||||||||||||
| 2 | package Software::Policies::Security::Individual; | ||||||||||||
| 3 | |||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use 5.010; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | # ABSTRACT: Create project policy file: Security / Individual | ||||||||||||
| 9 | |||||||||||||
| 10 | 1 | our $VERSION = '0.006'; | |||||||||||
| 11 | |||||||||||||
| 12 | 1 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | |||||||||||||
| 14 | 1 | ▶ | use Software::Security::Policy::Individual 0.11; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | |||||||||||||
| 16 | 0 | ▶ | sub new { | ||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 17 | 0 | my ($class) = @_; | |||||||||||
| 18 | 0 | return bless {}, $class; | |||||||||||
| 19 | } | ||||||||||||
| 20 | |||||||||||||
| 21 | 0 | ▶ | sub create { | ||||||||||
|
Subroutine
create: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||
| 22 | 0 | my ( $self, %args ) = @_; | |||||||||||
| 23 | 0 | ▶ | my $version = $args{'version'} // '1'; | ||||||||||
|
Condition0%0/2
$args{"version"} // 1
MC/DC0%0/1
$args{"version"} // 1
$args{"version"}
Truth table0%0/2
A
A= $args{"version"}
| |||||||||||||
| 24 | 0 | ▶ | my $format = $args{'format'} // 'markdown'; | ||||||||||
|
Condition0%0/2
$args{"format"} // "markdown"
MC/DC0%0/1
$args{"format"} // "markdown"
$args{"format"}
Truth table0%0/2
A
A= $args{"format"}
| |||||||||||||
| 25 | |||||||||||||
| 26 | 0 | my %attributes; | |||||||||||
| 27 | 0 | ▶ | my $attrs = $args{'attributes'} // {}; | ||||||||||
|
Condition0%0/2
$args{"attributes"} // {}
MC/DC0%0/1
$args{"attributes"} // {}
$args{"attributes"}
Truth table0%0/2
A
A= $args{"attributes"}
| |||||||||||||
| 28 | 0 | ▶ | $attributes{'maintainer'} = $attrs->{'authors'}->[0] if $attrs->{'authors'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 29 | 0 | ▶ | $attributes{'timeframe'} = $attrs->{'timeframe'} if $attrs->{'timeframe'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 30 | 0 | ▶ | $attributes{'timeframe_quantity'} = $attrs->{'timeframe_quantity'} if $attrs->{'timeframe_quantity'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | 0 | ▶ | $attributes{'timeframe_units'} = $attrs->{'timeframe_units'} if $attrs->{'timeframe_units'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 32 | 0 | ▶ | $attributes{'url'} = $attrs->{'url'} if $attrs->{'url'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | 0 | ▶ | $attributes{'git_url'} = $attrs->{'git_url'} if $attrs->{'git_url'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | 0 | ▶ | $attributes{'report_url'} = $attrs->{'report_url'} if $attrs->{'report_url'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | ▶ | $attributes{'perl_support_years'} = $attrs->{'perl_support_years'} if $attrs->{'perl_support_years'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 36 | 0 | ▶ | $attributes{'program'} = $attrs->{'name'} if $attrs->{'name'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | 0 | ▶ | $attributes{'program'} = $attrs->{'program'} if $attrs->{'program'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | 0 | ▶ | $attributes{'Program'} = $attrs->{'Program'} if $attrs->{'Program'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | 0 | ▶ | $attributes{'minimum_perl_version'} = $attrs->{'minimum_perl_version'} if $attrs->{'minimum_perl_version'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | croak q{Missing option 'maintainer'} | ||||||||||||
| 41 | 0 | ▶ | if ( !defined $attributes{'maintainer'} ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 42 | 0 | my $p = Software::Security::Policy::Individual->new( \%attributes ); | |||||||||||
| 43 | return ( | ||||||||||||
| 44 | 0 | policy => 'Contributing', | |||||||||||
| 45 | class => 'PerlDistZilla', | ||||||||||||
| 46 | version => $version, | ||||||||||||
| 47 | text => $p->fulltext, | ||||||||||||
| 48 | filename => _filename($format), | ||||||||||||
| 49 | format => $format, | ||||||||||||
| 50 | ); | ||||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | 0 | ▶ | sub get_available_classes_and_versions { | ||||||||||
|
Subroutine
get_available_classes_and_versions: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 54 | return { | ||||||||||||
| 55 | 0 | 'Individual' => { | |||||||||||
| 56 | versions => { | ||||||||||||
| 57 | '1' => 1, | ||||||||||||
| 58 | }, | ||||||||||||
| 59 | formats => { | ||||||||||||
| 60 | 'markdown' => 1, | ||||||||||||
| 61 | 'text' => 1, | ||||||||||||
| 62 | }, | ||||||||||||
| 63 | }, | ||||||||||||
| 64 | }; | ||||||||||||
| 65 | } | ||||||||||||
| 66 | |||||||||||||
| 67 | 0 | ▶ | sub _filename { | ||||||||||
|
Subroutine
_filename: not called CC=1 SCAR=6.9
| |||||||||||||
| 68 | 0 | my ($format) = @_; | |||||||||||
| 69 | 0 | my %formats = ( 'markdown' => 'SECURITY.md', ); | |||||||||||
| 70 | 0 | return $formats{$format}; | |||||||||||
| 71 | } | ||||||||||||
| 72 | |||||||||||||
| 73 | 1 | 1; | |||||||||||
| 74 | |||||||||||||
| 75 | __END__ | ||||||||||||