in reply to Re^2: Windows Serial Port Logging using Win32-SerialPort
in thread Windows Serial Port Logging using Win32-SerialPort

Something like this might do you. Essentially everything inside the async will happen concurrently with everything after it until you join the threads back together.

use threads; use threads::shared; use Win32::SerialPort; use Net::FTP; my $sp = new Wi3n32::SerialPort( ... ); ... my $count = $sp-write( $out ); my $done :shared = 0; my $t = async{ my $in; until( $done ) { my( $count, $byte ) = $sp->read( 1 ); warn "Read error" and next unless $count = 1; $in .= $byte; } return $in; }; my $ftp = new Net::FTP( ... ); $ftp->get( 'theFile' ); $ftp->done; $done = 1; my $input = $t->join;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^4: Windows Serial Port Logging using Win32-SerialPort
by dinasour (Novice) on Apr 18, 2010 at 02:01 UTC
    Hi Thanks . This does look promising. I will try to run this and post the results Thanks a ton for taking some time to look at this
      Hi I tried this but i still have perl 5.6.1 Does Perl 5.6.1 support this ? Thanks again

        5.6.1 did support threads, provided it was compiled with threads support. But they were buggy way back then, though the simple use above that probably won't matter much.

        But why are you still using 5.6.1? That's like still using a 386 cpu, the Netscape browser or rushing home to watch Friends re-runs.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.