NAME
    Check::Socket - Check socket communication functionality.

SYNOPSIS
     use Check::Socket qw(check_socket $ERROR_MESSAGE);

     my $ret = check_socket();
     print $ERROR_MESSAGE."\n";

DESCRIPTION
    There is need of check for socket communication functionality in tests.
    Actually we have many duplicated and not same check code in
    distributions. Sic!

    Intent of this module is create common code for check and test all
    behaviours. Extra thing is error message which describe issue.

SUBROUTINES
  "check_socket"
     my $ret = check_socket();

    Check possibility of socket communication functionality on system.
    Return value is 1 as possible use of socket functionality or 0 as not
    possible use of socket functionality. If return value is 0, set
    $ERROR_MESSAGE variable.

    Returns 0/1.

ERRORS
     check_socket():
             Set $ERROR_MESSAGE variable if $ret is 0:
                     Socket extension unavailable.
                     IO extension unavailable.
                     $^O: AF_UNIX unavailable or disabled.
                     $^O: Compiled without TCP/IP stack v4.
                     $^O: Skip sockets on CI.
                     $^O: UNIX domain sockets not implemented.

EXAMPLE1
     use strict;
     use warnings;

     use Check::Socket qw(check_socket $ERROR_MESSAGE);

     if (check_socket()) {
             print "We could use socket communication.\n";
     } else {
             print "We couldn't use socket communication.\n";
             print "Error message: $ERROR_MESSAGE\n";
     }

     # Output on Unix:
     # We could use socket communication.

EXAMPLE2
     use strict;
     use warnings;

     use Check::Fork qw(check_fork);
     use Check::Socket qw(check_socket);

     if (! check_fork()) {
             print "We couldn't fork.\n";
             print "Error message: $Check::Fork::ERROR_MESSAGE\n";
     } elsif (! check_socket()) {
             print "We couldn't use socket communication.\n";
             print "Error message: $Check::Socket::ERROR_MESSAGE\n";
     } else {
             print "We could use fork and socket communication.\n";
     }

     # Output on Unix:
     # We could use fork and socket communication.

DEPENDENCIES
    Config, Exporter, IO::Socket, Readonly.

SEE ALSO
    Check::Fork
        Check fork functionality.

REPOSITORY
    <https://github.com/michal-josef-spacek/Check-Socket>

AUTHOR
    Michal Josef Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    © 2021-2022 Michal Josef Špaček

    BSD 2-Clause License

VERSION
    0.02

