#!/usr/bin/perl
#

use strict;

use Sys::Virt;
use POSIX qw(:signal_h);

sub main {
    print "init... pid=$$","\n";
    $SIG{'CHLD'} = sub { print "receive chld","\n"; };

    while(1){
		print "while...","\n";

		last if( fork() == 0 );
		print "fork 1","\n";
		sleep(5);
		last if( fork() == 0 );
		print "fork 2","\n";
		sleep(5);

        my $dcon =  Sys::Virt->new( 'uri'=>'qemu+tls://10.10.4.249/system?no_verify=1' );
        #my $dcon =  Sys::Virt->new( 'uri'=>'test:///default' );
        #my $dcon =  Sys::Virt->new( 'uri'=>'qemu+libssh2://10.10.4.249/system?no_verify=1' );
		print "connection open","\n";

		sleep(5);
		last if( fork() == 0 );
		print "fork 3","\n";
		sleep(5);
		last if( fork() == 0 );
		print "fork 4","\n";
		sleep(5);
		print "go next...","\n";
    }
    print "end... pid=$$","\n";
}

&main;

1;
