File Coverage

blib/lib/SNMP/Insight/Meta/Attribute/Trait/MIBEntry.pm
Criterion Covered Total %
statement 6 9 66.6
branch n/a
condition n/a
subroutine 2 5 40.0
pod 3 3 100.0
total 11 17 64.7


line stmt bran cond sub pod time code
1             package SNMP::Insight::Meta::Attribute::Trait::MIBEntry;
2              
3             #ABSTRACT: Attribute trait for attributes derived from MIBs
4              
5 5     5   22 use Moose::Role;
  5         10  
  5         30  
6 5     5   19274 use Moose::Util::TypeConstraints;
  5         8  
  5         51  
7              
8             our $VERSION = '0.002'; #TRIAL VERSION:
9              
10             Moose::Util::meta_attribute_alias('MIBEntry');
11              
12             enum 'MIBEntryType', [qw(scalar table column)];
13              
14             has oid => (
15             is => 'rw',
16             isa => 'Str',
17             required => 1,
18             predicate => 'has_oid',
19             );
20              
21             has munger => (
22             is => 'rw',
23             isa => 'CodeRef',
24             required => 0,
25             predicate => 'has_munger',
26             );
27              
28             has entry_type => (
29             is => 'rw',
30             isa => 'MIBEntryType',
31             required => 1,
32             );
33              
34             sub is_scalar {
35 0     0 1   return $_[0]->entry_type eq 'scalar';
36             }
37              
38             sub is_table {
39 0     0 1   return $_[0]->entry_type eq 'table';
40             }
41              
42             sub is_column {
43 0     0 1   return $_[0]->entry_type eq 'column';
44             }
45              
46             1;
47              
48             # Local Variables:
49             # mode: cperl
50             # indent-tabs-mode: nil
51             # cperl-indent-level: 4
52             # cperl-indent-parens-as-block: t
53             # End:
54              
55             __END__
56              
57             =pod
58              
59             =head1 NAME
60              
61             SNMP::Insight::Meta::Attribute::Trait::MIBEntry - Attribute trait for attributes derived from MIBs
62              
63             =head1 VERSION
64              
65             version 0.002
66              
67             =head1 ATTRIBUTES
68              
69             =head2 oid
70              
71             The oid in the MIB.
72              
73             =head2 munger
74              
75             The code reference used, if present, to parse the value retrieved from the device.
76              
77             =head2 entry_type
78              
79             One of scalar, table, column.
80              
81             =head1 METHODS
82              
83             =head2 is_scalar
84              
85             Return true if it's a scalar entry
86              
87             =head2 is_table
88              
89             Return true if it's a table entry
90              
91             =head2 is_column
92              
93             Return true if it's a column entry
94              
95             =head1 AUTHOR
96              
97             Gabriele Mambrini <g.mambrini@gmail.com>
98              
99             =head1 COPYRIGHT AND LICENSE
100              
101             This software is copyright (c) 2015 by Gabriele Mambrini.
102              
103             This is free software; you can redistribute it and/or modify it under
104             the same terms as the Perl 5 programming language system itself.
105              
106             =cut