| 1 | package CSAF::Type::Flag; | ||
| 2 | |||
| 3 | 1 | ▶ | use 5.010001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 0 | ▶ | use CSAF::Util qw(parse_datetime); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 10 | |||
| 11 | extends 'CSAF::Type::Base'; | ||
| 12 | |||
| 13 | has label => (is => 'rw', required => 1); | ||
| 14 | has date => (is => 'rw', coerce => \&parse_datetime); | ||
| 15 | has group_ids => (is => 'rw', default => sub { [] }); | ||
| 16 | has product_ids => (is => 'rw', default => sub { [] }); | ||
| 17 | |||
| 18 | sub TO_CSAF { | ||
| 19 | |||
| 20 | my $self = shift; | ||
| 21 | |||
| 22 | my $output = {label => $self->label}; | ||
| 23 | |||
| 24 | $output->{date} = $self->date if ($self->date); | ||
| 25 | $output->{group_ids} = $self->group_ids if ($self->group_ids); | ||
| 26 | $output->{product_ids} = $self->product_ids if ($self->product_ids); | ||
| 27 | |||
| 28 | return $output; | ||
| 29 | |||
| 30 | } | ||
| 31 | |||
| 32 | 1; | ||
| 33 | |||
| 34 | __END__ | ||