| 1 | package XML::IODEF::Simple::Plugin::TLP; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | |||
| 6 | our $VERSION = '0.00_02'; | ||
| 7 | $VERSION = eval $VERSION; | ||
| 8 | |||
| 9 | my $map = { | ||
| 10 | amber => 'need-to-know', | ||
| 11 | red => 'private', | ||
| 12 | white => 'public', | ||
| 13 | green => 'need-to-know', | ||
| 14 | default => 'private', | ||
| 15 | }; | ||
| 16 | |||
| 17 | sub prepare { | ||
| 18 | my $class = shift; | ||
| 19 | my $info = shift; | ||
| 20 | return unless($info->{'restriction'}); | ||
| 21 | return unless(exists($map->{lc($info->{'restriction'})})); | ||
| 22 | return(1); | ||
| 23 | } | ||
| 24 | |||
| 25 | sub convert { | ||
| 26 | my $class = shift; | ||
| 27 | my $info = shift; | ||
| 28 | my $iodef = shift; | ||
| 29 | my $r = lc($info->{'restriction'}); | ||
| 30 | $info->{'restriction'} = $map->{$r}; | ||
| 31 | return($iodef); | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; | ||
| 35 | __END__ |