in reply to Re: Term ReadLine in OS X
in thread Term ReadLine in OS X

I installed Term::ReadLine::Perl and it fixed the problem. I also installed MacPorts. Now I am getting the error
Cannot open /dev/tty for read at /Users/mike/readline.pl
Thanks, Mike

Replies are listed 'Best First'.
Re^3: Term ReadLine in OS X
by kcott (Archbishop) on May 27, 2012 at 09:41 UTC

    That sounds like you installed Term::ReadLine::Perl before MacPorts. Please advise the order of installations.

    Please also show the code in /Users/mike/readline.pl.

    As stated, I "took the Perlbrew path" - I don't have a lot of experience with MacPorts. The MacPorts Guide may be of use to you.

    -- Ken

      I installed Term::ReadLine::Perl and then ran my program, which gave me the new error. After that, I installed MacPorts.

      Here is my code:
      #!/usr/bin/perl -w use Term::ReadLine; use strict; my $term = Term::ReadLine->new('readLine'); my $prompt = "> "; my $OUT = $term->OUT || \*STDOUT; print "Enter: \n"; my $result = $term->readline($prompt);
      Could I install Perlbrew alongside MacPorts and go that route?
      Thanks,
      Mike

        I feel a little reticent about giving further advice as you seem to be doing pretty much the opposite of what I'm saying. Regarding installing Term::ReadLine::Perl, I suggested trying this "In the absence of other solutions": you chose to do this first. Regarding Perlbrew/MacPorts/ActiveState, I said "You may want to consider these options before adding or updating modules used by your system Perl.": you chose to add/update Term::ReadLine::Perl on your system Perl. However, it's your computer and you should be free to break it in whatever interesting ways you see fit.

        I have a number of Perls installed - so you can "go that route":

        System Perl
        $ /usr/bin/perl -v This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-th +read-multi-2level (with 2 registered patches, see perl -V for more detail) ...
        Perlbrew Perl
        $ /usr/bin/env perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for darwin-th +read-multi-2level ...
        MacPorts Perl
        $ /opt/local/bin/perl -v This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-mu +lti-2level ...

        I tried your code above (presumably /Users/mike/readline.pl) with each of these three Perls. I was unable to reproduce your problem. I received no error or warning messages. I entered the same text for all of them:

        $ pm_readline_perl_mac.pl Enter: > 1+2 $ pm_readline_perl_mac.pl Enter: > blah blah $

        And finally, just for completeness, I haven't set PERL_RL:

        $ echo $PERL_RL $

        -- Ken