| [reply] |
I don't see cpan being mentioned anywhere in the OP. I suppose he's talking about accessing the regular shell's command history. Without more details it's hard to tell what the problem is, though. As ^[[A is the normal escape sequence generated by many terminals for the up key, it's probably a misconfiguration of the shell that's causing the problem.
| [reply] |
I didn't see cpan mentioned either, however since Ubuntu uses bash 'out of the box' the up arrow key works fine for command recall. While I agree that a broken shell is a possability I'd expect not the OP to have asked for help accessing previous commands rather than 'previous Perl' as explicitly stated. The modules I mentioned don't ship with with perl/ubuntu as default. Weither it's cpan related or as LanX suggests perl debugger, the advice I've given is accurate. However, as you quite accuratly state, without knowing exactly what the OP is really asking for, it could be several things.
| [reply] |
| [reply] [d/l] |
Perl is not an interactive shell, though there are plenty of features for you to be able to build an interactive shell using Perl.
When you type perl on an interactive shell such as bash on Linux then, without a program file to run, it reads the standard input stream, which, by default, comes from the keyboard. At this stage it does not care if the commands are being read from a file or a keyboard. If you look at perlsyn you will see that there is no 'up arrow' command in perl. The '^[[A' is a textual translation of what the terminal driver sends it.
Shells such as bash and ksh perform two functions, they are, like Perl, a scripting language, but they also provide an interactive interface. This is good because it enables you to do the kind of things you are trying, but it is bad because it has to compile each statement as you enter it. Shells are a compromise between these two needs. Use a text editor to enter your Perl program into a text file, starting with #!/usr/bin/perl, save it into a directory that is in your $PATH, give it execute access with chmod u+x and then run it as you would any other program. | [reply] [d/l] [select] |
Totally agree with Anonymous Monk, what is Perl's part here? Based on your description seems like your having problems with your shell, if so I'd ask in ubuntu's forums. Finally if the problem is that you want to access command history from Perl there is a hidden file ~/.bash_history with the command history that might be useful for your goals
| [reply] |