Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/Perl/at/beta_tests/test_pipe/01.pl

(Deskargatu)
#!/usr/bin/perl -w
#use strict;
my $chemin_f;
use Fcntl;

$chemin_f  = '/home/tfe/truc/at/test_pipe/.signature';


    if (-e $chemin_f)    {
	die "$0 : n ecrase pas le fichier\n";
    }
    else {
	require POSIX;
	POSIX::mkfifo($chemin_f,0666)
	    or die "mknod failed $! : $chemin_f\n";	
	warn "$0 a cree $chemin_f en tant que pipe\n";
    }

while (1) { 
    die "fichier a dispartu $!" unless (-p $chemin_f);
    sysopen(FIFO,$chemin_f,O_RDONLY) or die "Ecriture impossible";
    while (<FIFO>)
    {
    print "RECU: $_";
    }
}