On 23 April 2006 05:44, David Christensen wrote:
Dave Korn wrote:
Well then, that's a really good argument for just using the builtin
access that cygwin provides through /dev/ttySx instead, isn't it?
The way Oliver's original post reads suggests that he was just thrown
off by not seeing any devices under the virtual /dev dir, but that
doesn't mean it won't work for him if he tries it.
As they say in Perl parlance, TIMTOWDI ("there's more than one way to do
it").
I thought perl dudes tend to say things like TIMTOTNHAFTWTDAGT ("there is
more than one thousand nine hundread and forty-three ways to do any given
thing")....
If Oliver is a C, etc., programmer fluent in the /dev/ttySx API, then
it could work.
But you have a level confusion here. What you refer to as "the /dev/ttySx
API" is not a feature of C, any more than it's a feature of Perl. It's a
feature of POSIX programming environments. If you're on a POSIX system, you
get /dev/ttySx in *every* programming language - Perl, C, the whole lot.
Also, the very fact that Oliver was asking after where the /dev/ttySx
devices had gone to is kind of a giveaway that he feels happy using it, isn't
it? You need to actually /read/ people's questions and tailor your answers to
what they've asked, not what you feel would be good for them.
But if Oliver wants to write idiomatic Perl and get his
application going faster and easier,
You should perhaps have stated these conditions in your first post, it's a
bit less-informative to leave out the conditions which make a piece of advice
valid when you offer it.
then he wants to use standard and accepted CPAN libraries
Perl needs a library just to open and read and write a file and perhaps send
a few ioctls ????
BTW, to me, "print >>$FILE" *is* fairly "idiomatic perl", but I'm just not a
Perl expert I guess. Is this a case of "Real perl programmers don't output to
files!" ?
rather than roll his own (especially non-portable ones).
And you happen to know what Oliver wants to do? I didn't see him make any
suggestion he was going to roll hiw own libraries and use non-portable ones.
You're starting to make an /awful/ lot of assumptions here without having any
explicit knowledge of what Oliver actually wants.
Win32::SerialPort (Windows) and Device::SerialPort (Unix/Linux) are
the best approach under Perl. One or both may work under Cygwin; I haven't
done serial port programming in a number of years, and needed ActiveState
Perl the last time I did.
Trying to mix win32 perl and cygwin is a recipe for tears. Sure, use CPAN
modules, that is of course a good idea; but if the *nix one doesn't work under
cygwin, fixing it or rolling your own or even just using the bog-standard file
i/o features in perl is definitely far safer.
YMMV.
Well, that's the point isn't it? The OP just asked for help because he
wasn't sure of the mapping of com ports to /dev/ttySx numbers. Your advice to
install active state perl and some win32 module seems a bit more superfluous
effort than merely subtracting one from the com port number and using
/dev/ttySx.
Do perl people also say WDITEWWYCDITHWATTTALITB? "Why do it the easy way
when you can do it the hard way and take ten times as long into the bargain"?
;)
cheers,
DaveK