File Coverage

blib/lib/STIX/Common/GranularMarking.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 43 43 100.0


line stmt bran cond sub pod time code
1             package STIX::Common::GranularMarking;
2              
3 24     24   544 use 5.010001;
  24         113  
4 24     24   218 use strict;
  24         81  
  24         974  
5 24     24   162 use warnings;
  24         100  
  24         1732  
6 24     24   176 use utf8;
  24         63  
  24         231  
7              
8 24     24   1112 use STIX::Common::List;
  24         70  
  24         985  
9 24     24   167 use Types::Standard qw(InstanceOf Str);
  24         55  
  24         260  
10 24     24   52838 use Types::TypeTiny qw(ArrayLike);
  24         70  
  24         232  
11              
12 24     24   17345 use Moo;
  24         69  
  24         215  
13 24     24   12135 use namespace::autoclean;
  24         65  
  24         255  
14              
15             extends 'STIX::Object';
16              
17 24         2309 use constant SCHEMA =>
18 24     24   2737 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/common/granular-marking.json';
  24         59  
19              
20 24     24   193 use constant PROPERTIES => qw(lang marking_ref selectors);
  24         57  
  24         4803  
21              
22             has lang => (is => 'rw', isa => Str);
23             has marking_ref => (is => 'rw', isa => InstanceOf ['STIX::Common::MarkingDefinition']);
24             has selectors => (is => 'rw', required => 1, isa => ArrayLike [Str], default => sub { STIX::Common::List->new });
25              
26             1;
27              
28             =encoding utf-8
29              
30             =head1 NAME
31              
32             STIX::Common::GranularMarking - STIX Granular Marking
33              
34             =head1 SYNOPSIS
35              
36             use STIX::Common::GranularMarking;
37              
38             my $granular_marking = STIX::Common::GranularMarking->new();
39              
40              
41             =head1 DESCRIPTION
42              
43             The C type defines how the list of marking-definition
44             objects referenced by the marking_refs property to apply to a set of
45             content identified by the list of selectors in the selectors property.
46              
47              
48             =head2 METHODS
49              
50             L inherits all methods from L
51             and implements the following new ones.
52              
53             =over
54              
55             =item STIX::Common::GranularMarking->new(%properties)
56              
57             Create a new instance of L.
58              
59             =item $granular_marking->lang
60              
61             Identifies the language of the text identified by this marking.
62              
63             =item $granular_marking->marking_ref
64              
65             The C property specifies the ID of the marking-definition object
66             that describes the marking.
67              
68             =item $granular_marking->selectors
69              
70             A list of selectors for content contained within the STIX object in which
71             this property appears.
72              
73             =back
74              
75              
76             =head2 HELPERS
77              
78             =over
79              
80             =item $granular_marking->TO_JSON
81              
82             Helper for JSON encoders.
83              
84             =item $granular_marking->to_hash
85              
86             Return the object HASH.
87              
88             =item $granular_marking->to_string
89              
90             Encode the object in JSON.
91              
92             =item $granular_marking->validate
93              
94             Validate the object using JSON Schema (see L).
95              
96             =back
97              
98              
99             =head1 SUPPORT
100              
101             =head2 Bugs / Feature Requests
102              
103             Please report any bugs or feature requests through the issue tracker
104             at L.
105             You will be notified automatically of any progress on your issue.
106              
107             =head2 Source Code
108              
109             This is open source software. The code repository is available for
110             public review and contribution under the terms of the license.
111              
112             L
113              
114             git clone https://github.com/giterlizzi/perl-STIX.git
115              
116              
117             =head1 AUTHOR
118              
119             =over 4
120              
121             =item * Giuseppe Di Terlizzi
122              
123             =back
124              
125              
126             =head1 LICENSE AND COPYRIGHT
127              
128             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
129              
130             This is free software; you can redistribute it and/or modify it under
131             the same terms as the Perl 5 programming language system itself.
132              
133             =cut