The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Config::Inetd - Interface inetd's configuration file

SYNOPSIS

 use Config::Inetd;

 $inetd = Config::Inetd->new;

 if ($inetd->is_enabled(telnet => 'tcp')) {
     $inetd->disable(telnet => 'tcp');
 }

 print $inetd->dump_enabled;
 print $inetd->dump_disabled;

 print $inetd->{CONF}[6];

DESCRIPTION

Config::Inetd is an interface to inetd's configuration file inetd.conf; it simplifies checking and setting the enabled/disabled state of services and dumping them by their state.

CONSTRUCTOR

new

 $inetd = Config::Inetd->new('/path/to/inetd.conf');

Omitting the path to inetd.conf, will cause the default /etc/inetd.conf to be used.

METHODS

is_enabled

Checks whether a service is enlisted as enabled.

 $inetd->is_enabled($service => $protocol);

Returns 1 if the service is enlisted as enabled, 0 if enlisted as disabled, undef if the service does not exist.

enable

Enables a service.

 $inetd->enable($service => $protocol);

Returns 1 if the service has been enabled, 0 if no action has been taken.

It is recommended to preceedingly run is_enabled() to determine whether a service is disabled.

disable

Disables a service.

 $inetd->disable($service => $protocol);

Returns 1 if the service has been disabled, 0 if no action has been taken.

It is recommended to preceedingly run is_enabled() to determine whether a service is enabled.

dump_enabled

Dumps the enabled services.

 @dump = $inetd->dump_enabled;

Returns an array that consists of inetd configuration lines which are enabled services.

dump_disabled

Dumps the disabled services.

 @dump = $inetd->dump_disabled;

Returns an array that consists of inetd configuration lines which are disabled services.

INSTANCE DATA

The inetd configuration file is tied as instance data (newlines are preserved); it may be accessed via @{$inetd->{CONF}}.

SEE ALSO

Tie::File, inetd(8)

AUTHOR

Steven Schubiger <schubiger@cpan.org>

LICENSE

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html