File Coverage

blib/lib/STIX/Common/ExternalReference.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 35 35 100.0


line stmt bran cond sub pod time code
1             package STIX::Common::ExternalReference;
2              
3 24     24   586 use 5.010001;
  24         114  
4 24     24   157 use strict;
  24         62  
  24         856  
5 24     24   141 use warnings;
  24         54  
  24         1779  
6 24     24   171 use utf8;
  24         60  
  24         281  
7              
8 24     24   1380 use Types::Standard qw(Str InstanceOf);
  24         93  
  24         267  
9              
10 24     24   87641 use Moo;
  24         72  
  24         234  
11 24     24   14254 use namespace::autoclean;
  24         63  
  24         328  
12              
13             extends 'STIX::Object';
14              
15 24         2529 use constant SCHEMA =>
16 24     24   2869 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/common/external-reference.json';
  24         61  
17              
18 24     24   168 use constant PROPERTIES => qw(source_name description url hashes external_id);
  24         64  
  24         8781  
19              
20             has source_name => (is => 'rw', isa => Str, required => 1);
21             has description => (is => 'rw', isa => Str);
22             has url => (is => 'rw', isa => Str);
23             has hashes => (is => 'rw', isa => InstanceOf ['STIX::Common::Hashes']);
24             has external_id => (is => 'rw', isa => Str);
25              
26             1;
27              
28             =encoding utf-8
29              
30             =head1 NAME
31              
32             STIX::Common::ExternalReference - STIX External Reference
33              
34             =head1 SYNOPSIS
35              
36             use STIX::Common::ExternalReference;
37              
38             my $external_reference = STIX::Common::ExternalReference->new();
39              
40              
41             =head1 DESCRIPTION
42              
43             External references are used to describe pointers to information
44             represented outside of STIX.
45              
46              
47             =head2 METHODS
48              
49             L inherits all methods from L
50             and implements the following new ones.
51              
52             =over
53              
54             =item STIX::Common::ExternalReference->new(%properties)
55              
56             Create a new instance of L.
57              
58             =item $external_reference->description
59              
60             A human readable description
61              
62             =item $external_reference->hashes
63              
64             Specifies a dictionary of hashes for the file.
65              
66             =item $external_reference->url
67              
68             A URL reference to an external resource.
69              
70             =back
71              
72              
73             =head2 HELPERS
74              
75             =over
76              
77             =item $external_reference->TO_JSON
78              
79             Helper for JSON encoders.
80              
81             =item $external_reference->to_hash
82              
83             Return the object HASH.
84              
85             =item $external_reference->to_string
86              
87             Encode the object in JSON.
88              
89             =item $external_reference->validate
90              
91             Validate the object using JSON Schema (see L).
92              
93             =back
94              
95              
96             =head1 SUPPORT
97              
98             =head2 Bugs / Feature Requests
99              
100             Please report any bugs or feature requests through the issue tracker
101             at L.
102             You will be notified automatically of any progress on your issue.
103              
104             =head2 Source Code
105              
106             This is open source software. The code repository is available for
107             public review and contribution under the terms of the license.
108              
109             L
110              
111             git clone https://github.com/giterlizzi/perl-STIX.git
112              
113              
114             =head1 AUTHOR
115              
116             =over 4
117              
118             =item * Giuseppe Di Terlizzi
119              
120             =back
121              
122              
123             =head1 LICENSE AND COPYRIGHT
124              
125             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
126              
127             This is free software; you can redistribute it and/or modify it under
128             the same terms as the Perl 5 programming language system itself.
129              
130             =cut