| 1 | package JMX::Jmx4Perl::Alias::Object; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | JMX::Jmx4Perl::Alias::Object - Internal object representing a concrete alias | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | Simple object which describes an alias. It knows about the following read-only | ||||||||||||||||||||||||||||
| 10 | methods | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =over | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =item $alias->alias() | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | alias name in uppercase form (e.g. C<MEMORY_HEAP_USED>) | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =item $alias->name() | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | alias name in lowercase format (e.g. C<memory:heap:used>) | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =item $alias->description() | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | short description of the alias | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =item $alias->default() | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | default values for an alias, which can be overwritten by a specific | ||||||||||||||||||||||||||||
| 29 | L<JMX::Jmx4Perl::Product::BaseHandler>. This is an arrayref with two values: | ||||||||||||||||||||||||||||
| 30 | The MBean's name and the attribute or operation name. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =item $alias->type() | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | Either C<attribute> or C<operation>, depending on what kind of MBean part the | ||||||||||||||||||||||||||||
| 35 | alias stands for. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =back | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | Additional, the C<"">, C<==> and C<!=> operators are overloaded to naturally | ||||||||||||||||||||||||||||
| 40 | compare and stringify alias values. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =cut | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 5 | ▶ | use Scalar::Util qw(refaddr); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | use overload | ||||||||||||||||||||||||||||
| 47 | 5 | ▶ | q{""} => sub { (shift)->as_string(@_) }, | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | 2 | ▶ | q{==} => sub { (shift)->equals(@_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | q{!=} => sub { !(shift)->equals(@_) }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | ▶ | sub equals { | ||||||||||||||||||||||||||
|
Subroutine
equals: called CC=3 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | 2 | ▶ | return (ref $_[0] eq ref $_[1] && refaddr $_[0] == refaddr $_[1]) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $_[0] eq ref $_[1] and builtin::refaddr($_[0]) == builtin::refaddr($_[1])
MC/DC0%0/2
ref $_[0] eq ref $_[1] and builtin::refaddr($_[0]) == builtin::refaddr($_[1])
ref $_[0] eq ref $_[1]
builtin::refaddr($_[0]) == builtin::refaddr($_[1])
Truth table33%1/3
A and B
A= ref $_[0] eq ref $_[1]B= builtin::refaddr($_[0]) == builtin::refaddr($_[1])
| |||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 285 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 285 | my $class = shift; | |||||||||||||||||||||||||||
| 57 | 285 | ▶ | return bless { @_ },ref($class) || $class; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 5 | ▶ | sub as_string { return $_[0]->{alias}; } | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub alias { return shift->{alias}; } | ||||||||||||||||||||||||||
|
Subroutine
alias: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 62 | 1 | ▶ | sub name { return shift->{name}; } | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub description { return shift->{description}; } | ||||||||||||||||||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub default { return shift->{default}; } | ||||||||||||||||||||||||||
|
Subroutine
default: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub type { return shift->{type}; } | ||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | This file is part of jmx4perl. | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | Jmx4perl is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 72 | it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||
| 73 | the Free Software Foundation, either version 2 of the License, or | ||||||||||||||||||||||||||||
| 74 | (at your option) any later version. | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | jmx4perl is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 77 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 78 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||
| 79 | GNU General Public License for more details. | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||
| 82 | along with jmx4perl. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | A commercial license is available as well. Please contact roland@cpan.org for | ||||||||||||||||||||||||||||
| 85 | further details. | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head1 PROFESSIONAL SERVICES | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | Just in case you need professional support for this module (or Nagios or JMX in | ||||||||||||||||||||||||||||
| 90 | general), you might want to have a look at | ||||||||||||||||||||||||||||
| 91 | http://www.consol.com/opensource/nagios/. Contact roland.huss@consol.de for | ||||||||||||||||||||||||||||
| 92 | further information (or use the contact form at http://www.consol.com/contact/) | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | roland@cpan.org | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | =cut | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 5 | 1; | |||||||||||||||||||||||||||