title: How can I create a shell with history in my Perl program?
body: <p>I'm writing a tool that is executed as a shell in Perl. I want it to have a history, so that if you press the up arrow, you go back to the previous command, just like bash or other shells. How should I go about this?</p>
  
  <p>-- EDIT --</p>
  
  <p>Thanks to daxim for pointing me towards Term::ReadLine::Gnu. I was able to get it to work on my Linux box and it's exactly what I was looking for. However, my main dev machine is running OS X. When I try to install the module, I get this error:</p>
  
  <pre><code>~/Downloads/Term-ReadLine-Gnu-1.19 &gt; perl Makefile.PL 
  Found `/usr/lib/libtermcap.dylib'.
  gcc-4.2  -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -        DHAVE_STRING_H rlver.c -o rlver   -arch i386 -arch ppc -L/usr/local/lib -lreadline -ltermcap
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  The libreadline you are using is the libedit library.  Use the GNU Readline Library.
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  </code></pre>
  
  <p>I am currently making my way through the Google results for this problem, but if anyone has seen this before and has pointers, that would be much appreciated. Thanks!</p>