line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ISC::DHCPd::OMAPI::Control; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Net::ISC::DHCPd::OMAPI::Control - OMAPI control class |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SEE ALSO |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
L<Net::ISC::DHCPd::OMAPI::Actions>. |
10
|
|
|
|
|
|
|
L<Net::ISC::DHCPd::OMAPI::Meta::Attribute>. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Net::ISC::DHCPd::OMAPI; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$omapi = Net::ISC::DHCPd::OMAPI->new(...); |
17
|
|
|
|
|
|
|
$omapi->connect |
18
|
|
|
|
|
|
|
$control = $omapi->new_object("control", { $attr => $value }); |
19
|
|
|
|
|
|
|
$control->read; # retrieve server information |
20
|
|
|
|
|
|
|
$control->$attr($value); # update a value |
21
|
|
|
|
|
|
|
$control->write; # write to server |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
7
|
use Net::ISC::DHCPd::OMAPI::Sugar; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
26
|
1
|
|
|
1
|
|
1635
|
use Moose; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
9
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
with 'Net::ISC::DHCPd::OMAPI::Actions'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 shutdown_server |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$bool = $self->shutdown_server; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Will shutdown the remote server. See C<dhcpd.8> for details. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub shutdown_server { |
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
my $buffer; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->errstr(""); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
for my $cmd ("open", "set state = 2", "update") { |
47
|
|
|
|
|
|
|
($buffer) = $self->_cmd($cmd); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
unless($buffer =~ /state\s=/) { |
50
|
|
|
|
|
|
|
warn $buffer; |
51
|
|
|
|
|
|
|
$self->errstr($buffer); |
52
|
|
|
|
|
|
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$self->parent->disconnect; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
return 1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
around shutdown_server => \&Net::ISC::DHCPd::OMAPI::Actions::_around; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Most of the documentation is taken from C<dhcpd(8)>. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
See L<Net::ISC::DHCPd>. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
75
|
|
|
|
|
|
|
1; |