Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Win32 port listener (out of the blue)

by rje (Deacon)
on Dec 04, 2001 at 05:06 UTC ( #129245=perlquestion: print w/replies, xml ) Need Help??

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

Here's a question, out of the blue, for the gearheads.

Can perl operate a port on my PC? Can it listen for
signals and respond to them? Can it talk on the printer
port?

The thought just occurred to me that if it could, it would
be much easier for me personally to write a 'driver' for
a specialized application using the printer port,
than to write it in a language I don't have a compiler
for (C, for example).

My venerable Commodore 64 uses a really simple protocol
to talk to its disk drive; some have written drivers to
use the PC as a virtual disk drive for the Commodore.
Perhaps I can do that too, in perl...

Thanks for your time...

Rob

Replies are listed 'Best First'.
(jcwren) Re: Win32 port listener (out of the blue)
by jcwren (Prior) on Dec 04, 2001 at 05:58 UTC

    While you *could* do this in Perl, this isn't the kind of thing that Perl is particularly good at. You'd be far better off getting a copy of DJGPP for DOS/Windows, along with the Cygwin package. Alternatively, you can get the Borland (or whatever the heck they call themselves these days) for free, also.

    Of course, if you do this in Perl, it'll be a great way to get lots of experience with pack()/unpack(). Perl does not excel at doing the types of data structures that are best suited for this kind of task.

    And if you don't know C, you need to learn C, so you can help with the core Perl development, right?

    --Chris

    e-mail jcwren

      I feel safer doing it in perl, at least at first.
      Also, the development cycle is bound to be quicker
      than with C. I can always translate to C after the
      development is done.

      Yeah, I know C, but it's been awhile, and core Perl
      development sounds like an inaccessibly lofty perch
      for me.

      Thanks for the replies.

      Rob

Re: Win32 port listener (out of the blue)
by rob_au (Abbot) on Dec 04, 2001 at 05:25 UTC
    Depending on your application, there are a number of ways by which Perl can be used. For example, to speak serially with a device through Perl on the Windows platform, you could use Win32::SerialPort (on *NIX, the equivalent of this module is Device::SerialPort) - And from memory, the Commodore 64 disk drive and external devices all ran daisy-bussed on the serial port, so this may be a better direction for development.

    The biggest hurdle I would see would be determining the specifications of how your target device talks - That exactly how it receives its command set and its sample responses, not only logically, but also electrically. This in itself may be quite a hurdle to your development.

     

    perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://129245]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2022-06-30 10:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (97 votes). Check out past polls.

    Notices?