motasem1973 has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

the ActivePerl-FAQ (http://www.xav.com/perl/faq/Windows/ActivePerl-Winfaq8.html) says that users can use

open( PORT, "+> COM1" ) or die "Can't open COM1: $!";
for opening a serial port. That is working on my system. *But*, not reading nor writing is working as suggested with read() and print().

I have tried to pass AT commands to my nokia 6310 mobile phone using the print function as in follows:

open( PORT, "+> COM5" ) or die "Can't open COM5: $!"; print PORT "AT";
and i have tried to read feedback as using the following statement:
$a = <PORT>;
but I cannot get any results or prints. it seems that this suggestion is over simplistic, i do not know what i need to do.

I was also trying to work with that carriage return (\r) rsp. line feed (\n)issue but still could not get any result.

can anybody help?!

I'm using ActivePerl-5.8.0.804.

With best regards

Motasem

jdporter added code tags and some p tags

Replies are listed 'Best First'.
Re: accessing serial ports using activeperl
by beachbum (Beadle) on Dec 08, 2005 at 21:35 UTC
Re: accessing serial ports using activeperl
by TedYoung (Deacon) on Dec 08, 2005 at 21:41 UTC

    Definately consider a complete modules as suggested, but your problem might be buffering (this is a wild guess, I mean, really poking it with a stick ;-> ). Try:

    use IO::Handle; open PORT, ...; PORT->autoflush;

    Ted Young

    ($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)