#!/usr/bin/perl 


$rc="/etc/pblogan.conf";
do $rc || die "No existe configuracion base [$rc] ...\n" ;
open("portfh","+<$port") || die "opening $port for input: $!";
 
system("stty $psetting < $port");
while(1) {
    getmsg( "portfh" );
    sleep( 1 );
}
close("portfh");
 
 
sub getmsg {
    local $portfh = @_;
    local($inbuff,$rin) = ('','');
 
    vec($rin,fileno("portfh"),1) = 1;
    while ( select($rin, undef, undef, 0.3) ) {
        $char = '';
        sysread ("portfh",$char,1);
        $inbuff .= $char;
    }
    if( length( $inbuff ) > 0 ){
        open( LOG, ">>$log" );
        print LOG "$inbuff" ;
        close( LOG );
    }
    return;
}


