line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SolarWinds::ConstructorHash; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
81192
|
use strict; |
|
5
|
|
|
|
|
29
|
|
|
5
|
|
|
|
|
167
|
|
4
|
5
|
|
|
5
|
|
35
|
use warnings; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
189
|
|
5
|
5
|
|
|
5
|
|
34
|
use base qw( Net::SolarWinds::LogMethods); |
|
5
|
|
|
|
|
20
|
|
|
5
|
|
|
|
|
3583
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=pod |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Net::SolarWinds::ConstructorHash - Default Hash object constructor |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package MyClass; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use base qw(Net::SolarWinds::ConstructorHash); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $pkg=new MyClass(key=>'value'); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This library provides a common base line construcotor that accepts an arbitrary key=>value pair set. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 Setting default constructor values. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
To create default constructor values, simply use the inherited OO constructor example: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
|
|
|
|
|
|
my ($class,%args)=@_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return $class->SUPER::new( |
36
|
|
|
|
|
|
|
some_argument=>'default_value', |
37
|
|
|
|
|
|
|
%args |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 OO Methods provided |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=over 4 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item * Object constructor |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This class provides a basic object constructor that accepts hash key value pairs as its arguments. Keep in mind there are a few reserved hash keys. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Reserved hash keys: |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
_shutdown=>0|1 |
52
|
|
|
|
|
|
|
# wich is used to manage the shutdown state. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
log=>undef|Net::SolarWinds::Log instance |
55
|
|
|
|
|
|
|
# this key represents the log object ( if passed into the constructor as class->new(log=>Net::SolarWinds::Log->new()) ) |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
60
|
27
|
|
|
27
|
0
|
2821
|
my ( $class, %args ) = @_; |
61
|
|
|
|
|
|
|
|
62
|
27
|
|
|
|
|
242
|
my $self = bless { log => undef, _shutdown => 0, %args }, $class; |
63
|
|
|
|
|
|
|
|
64
|
27
|
|
|
|
|
188
|
return $self; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * $self->is_shutdown |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This method should be used when running infinate loops to see if the application should stop running its extended loop. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
4
|
|
|
4
|
1
|
48
|
sub is_shutdown { return $_[0]->{_shutdown} } |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * $self->set_shutdown |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Sets the object into the shutdown state. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
2
|
|
|
2
|
1
|
16
|
sub set_shutdown { $_[0]->{_shutdown} = 1 } |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=back |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Michael Shipper |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |