Unfortunately it seems that the OS in question (ubuntu) lacks packages for IO::Termios.

Yes, IO::Termios needs to be installed from CPAN, using e.g. cpanm, although installing modules into the system Perl has the caveats that uninstallation is tricky and it may clash with modules installed using the system's package manager. You could consider local::lib or even perlbrew, and it's also possible to install modules to some other global directory where they won't clash with modules installed by the system package manager (depending on the distro, that could be something like perhaps /usr/local/lib/site_perl, check your perl -V output for the preconfigured @INC).

But it definitely didn't die while setting 19200, which it now does.

Yes, that is indeed strange. Can you say what the old and new versions of IO::Stty and Perl were?

Lastly, I looked at your link about system -- maybe I'm missing something, but system(LIST) seems to be just fine?

Well, on a *NIX system the system(LIST) form should be "safe". Using a module gives you the advantage of built-in error handling (e.g. IPC::System::Simple, which has a drop-in replacement for system), or the ability to capture STDOUT/ERR in case you want to hide it from the user or inspect it for error messages (e.g. IPC::Run3). If you don't care about those things, then yes, system(LIST) where LIST has two or more elements is fine.

(BTW, an open mode of +> will clobber the file first - for a serial port it's probably fine, but for regular files you would probably want +< for read-write access instead.)


In reply to Re^3: How to set tty settings from perl by haukex
in thread How to set tty settings from perl by Sec

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.