in reply to stty functionality in Perl

You have to use POSIX::Termios, see POSIX. Alternatively, call the raw ioctls.

Replies are listed 'Best First'.
Re^2: stty functionality in Perl
by CountOrlok (Friar) on Apr 08, 2005 at 20:00 UTC
    With POSIX, I could do this:
    #!/usr/bin/perl use strict; use POSIX qw(:termios_h); my $term = POSIX::Termios->new; $term->getattr(fileno(STDIN)); print join(" - ", IGNCR, ECHO, ~ECHO, ECHOK, ICANON, $term->getlflag() + )." \n"; print ($term->getlflag() | (ECHO | ECHOK |ICANON) ); print "\n"; print ($term->getlflag() & ~(ECHO | ECHOK |ICANON) ); print "\n"; print ($term->getlflag() | (ECHO | ECHOK |ICANON) ); print "\n";
    Is there a simpler way than this to set and unset raw/crlf or echo on/off mode?

      Yes, I call stty from the perl code like

      system "stty", qw"-echo -echonl -echoke -echoe -isig" and die "error during stty"; ... system "stty", "sane" and warn "cannot reset stty settings";
      in a script I've written. Replace the flags with whatever you want. If you don't want to install addittional modules, I doubt there's a simpler way then these two.

      Well ... yes. Term::ReadKey but your boss is in the way there if it's not on your system or system but your in your own way not wanting to use system.

      -derby
        We have been using the system function, but just as with installing extra modules, my boss does not want us to use system().