File Coverage

blib/lib/STIX/Observable/EmailAddr.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::Observable::EmailAddr;
2              
3 24     24   573 use 5.010001;
  24         109  
4 24     24   204 use strict;
  24         51  
  24         727  
5 24     24   144 use warnings;
  24         73  
  24         1558  
6 24     24   196 use utf8;
  24         75  
  24         247  
7              
8 24     24   1456 use Types::Standard qw(Str InstanceOf);
  24         75  
  24         290  
9              
10 24     24   84122 use Moo;
  24         65  
  24         211  
11 24     24   11056 use namespace::autoclean;
  24         55  
  24         297  
12              
13             extends 'STIX::Observable';
14              
15 24         2482 use constant SCHEMA =>
16 24     24   2590 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/observables/email-addr.json';
  24         56  
17              
18 24         1720 use constant PROPERTIES => (
19             qw(type id),
20             qw(spec_version object_marking_refs granular_markings defanged extensions),
21             qw(value display_name belongs_to_ref)
22 24     24   156 );
  24         60  
23              
24 24     24   149 use constant STIX_OBJECT => 'SCO';
  24         65  
  24         1309  
25 24     24   162 use constant STIX_OBJECT_TYPE => 'email-addr';
  24         52  
  24         3494  
26              
27             has value => (is => 'rw', isa => Str, required => 1);
28             has display_name => (is => 'rw', isa => Str);
29             has belongs_to_ref => (is => 'rw', isa => InstanceOf ['STIX::Observable::UserAccount']);
30              
31             1;
32              
33             =encoding utf-8
34              
35             =head1 NAME
36              
37             STIX::Observable::EmailAddr - STIX Cyber-observable Object (SCO) - Email Address
38              
39             =head1 SYNOPSIS
40              
41             use STIX::Observable::EmailAddr;
42              
43             my $email_addr = STIX::Observable::EmailAddr->new();
44              
45              
46             =head1 DESCRIPTION
47              
48             The Email Address Object represents a single email address.
49              
50              
51             =head2 METHODS
52              
53             L inherits all methods from L
54             and implements the following new ones.
55              
56             =over
57              
58             =item STIX::Observable::EmailAddr->new(%properties)
59              
60             Create a new instance of L.
61              
62             =item $email_addr->belongs_to_ref
63              
64             Specifies the user account that the email address belongs to, as a
65             reference to a User Account Object.
66              
67             =item $email_addr->display_name
68              
69             Specifies a single email display name, i.e., the name that is displayed to
70             the human user of a mail application.
71              
72             =item $email_addr->id
73              
74             =item $email_addr->type
75              
76             The value of this property MUST be C.
77              
78             =item $email_addr->value
79              
80             Specifies a single email address. This MUST not include the display name.
81              
82             =back
83              
84              
85             =head2 HELPERS
86              
87             =over
88              
89             =item $email_addr->TO_JSON
90              
91             Encode the object in JSON.
92              
93             =item $email_addr->to_hash
94              
95             Return the object HASH.
96              
97             =item $email_addr->to_string
98              
99             Encode the object in JSON.
100              
101             =item $email_addr->validate
102              
103             Validate the object using JSON Schema
104             (see L).
105              
106             =back
107              
108              
109             =head1 SUPPORT
110              
111             =head2 Bugs / Feature Requests
112              
113             Please report any bugs or feature requests through the issue tracker
114             at L.
115             You will be notified automatically of any progress on your issue.
116              
117             =head2 Source Code
118              
119             This is open source software. The code repository is available for
120             public review and contribution under the terms of the license.
121              
122             L
123              
124             git clone https://github.com/giterlizzi/perl-STIX.git
125              
126              
127             =head1 AUTHOR
128              
129             =over 4
130              
131             =item * Giuseppe Di Terlizzi
132              
133             =back
134              
135              
136             =head1 LICENSE AND COPYRIGHT
137              
138             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
139              
140             This is free software; you can redistribute it and/or modify it under
141             the same terms as the Perl 5 programming language system itself.
142              
143             =cut