I am looking to write a bit of perl that I can run in the background to interface with a GPI trigger for broadcast television gear.
Essentially, I need a script that will sit and listen for a mouse click from /dev/ttyS0 and then act appropriately.

I don't need to listen for any other mouse data or generate any kind of GUI stuff, just detect the click.

As a bonus, if the mouse button is held down, it would be nice to be able to detect that it's being held down, and also detect when the button is released.

I've seen a fair number of pointers to things like Perl/tk in reference to mouse detection within a GUI framework, but I am hoping there may be a bare-bones way to do it with less overhead. I've also looked at Device::SerialPort but I didn't see anything that I thought I could apply to listening for a mouse.

Any clever thoughts would be greatly appreciated.
Any dull thoughts would be welcome, too.

In reply to Detecting Mouse Clicks (GPI Trigger) by Captain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.