BSD-Sysctl
view release on metacpan or search on metacpan
In some circumstances a reference to an array is returned, when the
variable represents a list of values (for instance, C<kern.cp_time>).
In other circumstances, a reference to a hash is returned, when the
variable represents a heterogeneous collection of values (for
instance, C<kern.clockrate>, C<vm.vmtotal>). In these cases, the
hash key names are reasonably self-explanatory, however, passing
familiarity with kernel data structures is expected.
A certain number of opaque variables are fully decoded (and the
results are returned as hashes), whereas the C<sysctl> binary renders
them as a raw hexdump (for example, C<net.inet.tcp.stats>).
=item sysctl_set
Perform a system call to set a sysctl variable to a new value.
if( !sysctl_set( 'net.inet.udp.blackhole', 1 )) {
warn "That didn't work: $!\n";
}
Set the value of the C<sysctl> variable. Returns true on success,
C<undef> on failure.
$variable->set(99);
=item iterator
Creates an iterator that may be used to walk through the sysctl
variable tree. If no parameter is given, the iterator defaults
to the first entry of the tree. Otherwise, if a paramter is
given, it is decoded as a sysctl variable. If the decoding
fails, undef is returned.
my $k = BSD::Sysctl->iterator( 'kern' );
while ($k->next) {
print $k->name, '=', $k->value, "\n";
}
=item next
Moves the iterator to the next sysctl variable and loads the
( run in 0.438 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )