File Coverage

blib/lib/STIX/Observable/MACAddr.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::MACAddr;
2              
3 24     24   537 use 5.010001;
  24         110  
4 24     24   201 use strict;
  24         66  
  24         734  
5 24     24   118 use warnings;
  24         50  
  24         1359  
6 24     24   147 use utf8;
  24         45  
  24         196  
7              
8 24     24   1214 use Types::Standard qw(StrMatch);
  24         63  
  24         255  
9              
10 24     24   73594 use Moo;
  24         67  
  24         202  
11 24     24   10712 use namespace::autoclean;
  24         62  
  24         268  
12              
13             extends 'STIX::Observable';
14              
15 24         2309 use constant SCHEMA =>
16 24     24   2486 'http://raw.githubusercontent.com/oasis-open/cti-stix2-json-schemas/stix2.1/schemas/observables/mac-addr.json';
  24         58  
17              
18 24         1729 use constant PROPERTIES =>
19 24     24   157 (qw(type id), qw(spec_version object_marking_refs granular_markings defanged extensions), qw(value));
  24         51  
20              
21 24     24   152 use constant STIX_OBJECT => 'SCO';
  24         55  
  24         1630  
22 24     24   169 use constant STIX_OBJECT_TYPE => 'mac-addr';
  24         58  
  24         4540  
23              
24             has value => (is => 'rw', isa => StrMatch [qr/^([0-9a-f]{2}[:]){5}([0-9a-f]{2})$/], required => 1);
25              
26             1;
27              
28             =encoding utf-8
29              
30             =head1 NAME
31              
32             STIX::Observable::MACAddr - STIX Cyber-observable Object (SCO) - Media Access Control (MAC) Address
33              
34             =head1 SYNOPSIS
35              
36             use STIX::Observable::MACAddr;
37              
38             my $mac_addr = STIX::Observable::MACAddr->new();
39              
40              
41             =head1 DESCRIPTION
42              
43             The MAC Address Object represents a single Media Access Control (MAC)
44             address.
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::Observable::MACAddr->new(%properties)
55              
56             Create a new instance of L.
57              
58             =item $mac_addr->id
59              
60             =item $mac_addr->type
61              
62             The value of this property MUST be C.
63              
64             =item $mac_addr->value
65              
66             Specifies one or more mac addresses expressed using CIDR notation.
67              
68             =back
69              
70              
71             =head2 HELPERS
72              
73             =over
74              
75             =item $mac_addr->TO_JSON
76              
77             Encode the object in JSON.
78              
79             =item $mac_addr->to_hash
80              
81             Return the object HASH.
82              
83             =item $mac_addr->to_string
84              
85             Encode the object in JSON.
86              
87             =item $mac_addr->validate
88              
89             Validate the object using JSON Schema
90             (see L).
91              
92             =back
93              
94              
95             =head1 SUPPORT
96              
97             =head2 Bugs / Feature Requests
98              
99             Please report any bugs or feature requests through the issue tracker
100             at L.
101             You will be notified automatically of any progress on your issue.
102              
103             =head2 Source Code
104              
105             This is open source software. The code repository is available for
106             public review and contribution under the terms of the license.
107              
108             L
109              
110             git clone https://github.com/giterlizzi/perl-STIX.git
111              
112              
113             =head1 AUTHOR
114              
115             =over 4
116              
117             =item * Giuseppe Di Terlizzi
118              
119             =back
120              
121              
122             =head1 LICENSE AND COPYRIGHT
123              
124             This software is copyright (c) 2024 by Giuseppe Di Terlizzi.
125              
126             This is free software; you can redistribute it and/or modify it under
127             the same terms as the Perl 5 programming language system itself.
128              
129             =cut