File Coverage

blib/lib/STIX/Note.pm
Criterion Covered Total %
statement 38 38 100.0
branch n/a
condition n/a
subroutine 13 13 100.0
pod n/a
total 51 51 100.0


line stmt bran cond sub pod time code
1             package STIX::Note;
2              
3 24     24   533 use 5.010001;
  24         104  
4 24     24   147 use strict;
  24         42  
  24         662  
5 24     24   139 use warnings;
  24         61  
  24         1421  
6 24     24   136 use utf8;
  24         51  
  24         216  
7              
8 24     24   1008 use STIX::Common::List;
  24         69  
  24         1285  
9 24     24   148 use Types::Standard qw(Str InstanceOf);
  24         41  
  24         250  
10 24     24   79471 use Types::TypeTiny qw(ArrayLike);
  24         64  
  24         207  
11              
12 24     24   13612 use Moo;
  24         57  
  24         233  
13              
14 24     24   10912 use namespace::autoclean;
  24         57  
  24         297  
15              
16             extends 'STIX::Common::Properties';
17              
18 24         2669 use constant SCHEMA =>
19 24     24   2648 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/sdos/note.json';
  24         59  
20              
21 24         1757 use constant PROPERTIES => (
22             qw(type spec_version id created modified),
23             qw(created_by_ref revoked labels confidence lang external_references object_marking_refs granular_markings extensions),
24             qw(abstract content authors object_refs)
25 24     24   152 );
  24         47  
26              
27 24     24   142 use constant STIX_OBJECT => 'SDO';
  24         47  
  24         1182  
28 24     24   164 use constant STIX_OBJECT_TYPE => 'note';
  24         53  
  24         4998  
29              
30             has abstract => (is => 'rw', isa => Str);
31             has content => (is => 'rw', isa => Str, required => 1);
32             has authors => (is => 'rw', isa => ArrayLike [Str], default => sub { STIX::Common::List->new });
33             has object_refs => (
34             is => 'rw',
35             isa => ArrayLike [InstanceOf ['STIX::Object', 'STIX::Common::Identifier']],
36             required => 1,
37             default => sub { [] }
38             );
39              
40             1;
41              
42             =encoding utf-8
43              
44             =head1 NAME
45              
46             STIX::Note - STIX Domain Object (SDO) - Note
47              
48             =head1 SYNOPSIS
49              
50             use STIX::Note;
51              
52             my $note = STIX::Note->new();
53              
54              
55             =head1 DESCRIPTION
56              
57             A Note is a comment or note containing informative text to help explain the
58             context of one or more STIX Objects (SDOs or SROs) or to provide additional
59             analysis that is not contained in the original object.
60              
61              
62             =head2 METHODS
63              
64             L inherits all methods from L
65             and implements the following new ones.
66              
67             =over
68              
69             =item STIX::Note->new(%properties)
70              
71             Create a new instance of L.
72              
73             =item $note->abstract
74              
75             A brief summary of the note.
76              
77             =item $note->authors
78              
79             The name of the author(s) of this note (e.g., the analyst(s) that created
80             it).
81              
82             =item $note->content
83              
84             The content of the note.
85              
86             =item $note->id
87              
88             =item $note->object_refs
89              
90             The STIX Objects (SDOs and SROs) that the note is being applied to.
91              
92             =item $note->type
93              
94             The type of this object, which MUST be the literal C.
95              
96             =back
97              
98              
99             =head2 HELPERS
100              
101             =over
102              
103             =item $note->TO_JSON
104              
105             Encode the object in JSON.
106              
107             =item $note->to_hash
108              
109             Return the object HASH.
110              
111             =item $note->to_string
112              
113             Encode the object in JSON.
114              
115             =item $note->validate
116              
117             Validate the object using JSON Schema (see L).
118              
119             =back
120              
121              
122             =head1 SUPPORT
123              
124             =head2 Bugs / Feature Requests
125              
126             Please report any bugs or feature requests through the issue tracker
127             at L.
128             You will be notified automatically of any progress on your issue.
129              
130             =head2 Source Code
131              
132             This is open source software. The code repository is available for
133             public review and contribution under the terms of the license.
134              
135             L
136              
137             git clone https://github.com/giterlizzi/perl-STIX.git
138              
139              
140             =head1 AUTHOR
141              
142             =over 4
143              
144             =item * Giuseppe Di Terlizzi
145              
146             =back
147              
148              
149             =head1 LICENSE AND COPYRIGHT
150              
151             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
152              
153             This is free software; you can redistribute it and/or modify it under
154             the same terms as the Perl 5 programming language system itself.
155              
156             =cut