IO-FD

 view release on metacpan or  search on metacpan

t/00-IO-FD.t  view on Meta::CPAN

# Before 'make install' is performed this script should be runnable with
# 'make test'. After 'make install' it should work as 'perl IO-FD.t'

#########################

# change 'tests => 1' to 'tests => last_test_to_print';

use strict;
use warnings;
use feature ":all";

use Test::More tests => 1;
BEGIN { use_ok('IO::FD') };


t/01-mkfifo.t  view on Meta::CPAN

use Fcntl qw<O_CREAT O_RDONLY O_WRONLY O_RDWR O_NONBLOCK F_SETFL F_GETFL>;
use Errno qw<EAGAIN>;

#fifo testing
{
  my $path=dirname(__FILE__);
  $path.="/test.fifo";
  if(-e $path){
    unlink $path;
  }
  use feature ":all";
  ok defined IO::FD::mkfifo $path;#, O_CREATE|O_WRONLY;

  my $fd;
  my $ret;
  my $counter=0;
  # Open first end in the fifo in RDWR and non block
  do {
    $ret=IO::FD::sysopen $fd, $path, O_RDWR|O_NONBLOCK;
    sleep 1;
    die "Waiting to long for non blocking fifo open" if $counter++>5;

t/02-accept.t  view on Meta::CPAN

# This is a complicated file to test the status flags of a accepted socket using the
# different type of accept functions  in IO::FD
# The listening sockets is placed in nonblocking mode which should result in non blocking accepted sockets 
# bsd type operating systems and but blocking on linux
#
#The normal accept will result in this behaviour
#The accept4 test  test the flags applied
#The accept_multiple forces non blocking on  all
#
use feature ":all";
use strict;
use warnings;
use Test::More;
use IO::FD;

use Fcntl qw<FD_CLOEXEC O_NONBLOCK F_SETFL F_GETFD F_GETFL>;
use POSIX qw<EAGAIN EINPROGRESS>;
use Errno ":POSIX";

use Socket ":all";

t/02-sendfile.t  view on Meta::CPAN

use strict;
use warnings;
use feature ":all";
use Test::More;
use IO::FD;
use Fcntl qw<O_NONBLOCK F_SETFL O_RDWR O_CREAT>;
use POSIX qw<errno_h>;
use Socket ":all";


# Netbsd does not support sendfile
use Config;
my @vers=split /\./, $Config{osvers};

t/03-select.t  view on Meta::CPAN

use Test::More tests=>1;
use feature ":all";

use IO::FD;

use Fcntl;
ok defined IO::FD::pipe(my $read,my $write);
for($read,$write){
	my $flags=IO::FD::fcntl( $_, F_GETFL,0);
	IO::FD::fcntl($_, F_SETFL, $flags|O_NONBLOCK);
}

t/04-poll.t  view on Meta::CPAN

use Test::More;
use lib "lib";
use lib "blib/lib";
use lib "blib/arch";

use IO::FD;
use IO::FD::Constants;

use feature ":all";
#say @IO::FD::Constants::EXPORT;

use Fcntl;
use strict;
use warnings;
################################
# use constant {               #
#         POLLIN=>0x0001,      #
#         POLLPRI=>0x0002,     #
#         POLLOUT=>0x0004,     #

t/05-kqueue.t.dis  view on Meta::CPAN

use Test::More;
use lib "lib";
use lib "blib/lib";
use lib "blib/arch";

use IO::FD;
use IO::FD::Constants;

use feature ":all";
#say @IO::FD::Constants::names;

use Fcntl;

use strict;
use warnings;

plan skip_all => "kqueue not supported on  $^O" if $^O !~ /darwin|bsd/i;

my $kq=IO::FD::kqueue();



( run in 0.352 second using v1.01-cache-2.11-cpan-cba739cd03b )