Anonymous avatar Anonymous committed 2760bb5 Draft

Upgrade included Console::Virtual to 2.0.

Comments (0)

Files changed (6)

lib/console-virtual/Console/Input/Curses.pm

 
   cbreak; # optimistic
   noecho; # optimistic
+
+  $::SIG{__DIE__} = sub($) {
+    my $msg = shift;
+    nocbreak;
+    echo;
+    endwin;
+    die $msg;
+  }
 }
 
 sub getkey

lib/console-virtual/Console/Virtual.pm

 # Console::Virtual.pm - unbuffered-input/addressed-display layer
-# v2007.1122 Chris Pressey, Cat's Eye Technologies
+# version 2.0 (February 2013)
 
-# Copyright (c)2003-2007, Chris Pressey, Cat's Eye Technologies.
+# Copyright (c)2003-2013, Chris Pressey, Cat's Eye Technologies.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
   use 5;
   use strict qw(subs);
   use Exporter;
-  $VERSION = 2007.1122;
+  $VERSION = 2.0;
   @ISA = qw(Exporter);
   @EXPORT_OK = qw(&display &clrscr &clreol &gotoxy
                   &bold &inverse &normal
-                  &update_display &getkey &color);
+                  &update_display &getkey &color
+                  &vsleep);
 }
 
 %setup = ();
 
 BEGIN
 {
-  my $c;
-  my $fc = 0;  # found Curses.pm?
-  my $fs = 0;  # found Term::Screen?
-  my $fp = 0;  # found POSIX.pm?
-  my $ft = 0;  # found $TERM and /etc/termcap?
-  foreach $c (@INC)
+  my $found_curses = 0;      # found Curses.pm?
+  my $found_term_screen = 0; # found Term::Screen?
+  my $found_posix = 0;       # found POSIX.pm?
+  my $found_termcap = 0;     # found $TERM and /etc/termcap?
+  foreach my $path (@INC)
   {
-    $fc = 1 if -r "$c/Curses.pm";
-    $fs = 1 if -r "$c/Term/Screen.pm";
-    $fp = 1 if -r "$c/POSIX.pm";
+    $found_curses = 1 if -r "$path/Curses.pm";
+    $found_term_screen = 1 if -r "$path/Term/Screen.pm";
+    $found_posix = 1 if -r "$path/POSIX.pm";
   }
-  $ft = $ENV{TERM} && -r "/etc/termcap";
+  $found_termcap = $ENV{TERM} && -r "/etc/termcap";
   $| = 1;
 
   # Determine raw input module to use.
   # This can be pre-set by the calling code
   # by modifying %Console::Virtual::setup.
 
-  if (defined $setup{input})
+  if (not defined $setup{input})
   {
-    require "Console/Input/$setup{input}.pm";
+    if ($found_curses)
+    {
+      $setup{input} = 'Curses';
+    }
+    elsif ($^O eq 'MSWin32')
+    {
+      $setup{input} = 'Win32';
+    }
+    elsif ($found_term_screen)
+    {
+      $setup{input} = 'Screen';
+    }
+    elsif ($found_posix)
+    {
+      $setup{input} = 'POSIX';
+    } else
+    {
+      warn "Warning! Raw input probably not available on this '$^O' system.\n";
+      $setup{input} = 'Teletype';
+    }
   }
-  elsif ($fc)
-  {
-    require Console::Input::Curses;
-    $setup{input} = 'Curses';
-  }
-  elsif ($^O eq 'MSWin32')
-  {
-    require Console::Input::Win32;
-    $setup{input} = 'Win32';
-  }
-  elsif ($fs)
-  {
-    require Console::Input::Screen;
-    $setup{input} = 'Screen';
-  }
-  elsif ($fp)
-  {
-    require Console::Input::POSIX;
-    $setup{input} = 'POSIX';
-  } else
-  {
-    warn "Warning! Raw input probably not available on this '$^O' system.\n";
-    require Console::Input::Teletype;
-    $setup{input} = 'Teletype';
-  }
+  require "Console/Input/$setup{input}.pm";
 
   # Determine screen-addressed output method to use.
   # This can be pre-set by the calling code
   # by modifying %Console::Virtual::setup.
 
-  if (defined $setup{display})
+  if (not defined $setup{display})
   {
-    require "Console/Display/$setup{display}.pm";
+    if ($found_curses)
+    {
+      $setup{display} = 'Curses';
+    }
+    elsif ($^O eq 'MSWin32')
+    {
+      $setup{display} = 'Win32';
+    }
+    elsif ($found_term_screen)
+    {
+      $setup{display} = 'Screen';
+    }
+    elsif ($found_termcap)
+    {
+      $setup{display} = 'Tput';
+    } else
+    {
+      warn "Addressable screen must be emulated on this '$^O' system";
+      $setup{display} = 'Teletype';
+    }
   }
-  elsif ($fc)
-  {
-    require Console::Display::Curses;
-    $setup{display} = 'Curses';
-  }
-  elsif ($^O eq 'MSWin32')
-  {
-    require Console::Display::Win32;
-    $setup{display} = 'Win32';
-  }
-  elsif ($fs)
-  {
-    require Console::Display::Screen;
-    $setup{display} = 'Screen';
-  }
-  elsif ($ft)
-  {
-    require Console::Display::Tput;
-    $setup{display} = 'Tput';
-  } else
-  {
-    warn "Addressable screen must be emulated on this '$^O' system";
-    require Console::Display::Teletype;
-    $setup{display} = 'Teletype';
-  }
+  require "Console/Display/$setup{display}.pm";
 
   # 2001.01.27 CAP
   # Determine color module to use.
   # This can be pre-set by the calling code
   # by modifying %Console::Virtual::setup.
 
-  if (defined $setup{color})
+  if (not defined $setup{color})
   {
-    require "Console/Color/$setup{color}.pm";
+    if ($found_curses)
+    {
+      $setup{color} = 'Curses';
+    }
+    elsif ($^O eq 'MSWin32')
+    {
+      $setup{color} = 'Win32';
+    }
+    elsif ($found_term_screen)
+    {
+      # $setup{color} = 'Screen';    # TODO! needs to be written
+      $setup{color} = 'ANSI16';      # not a very general solution
+    }
+    else
+    {
+      $setup{color} = 'Mono';
+    }
   }
-  elsif ($fc)
-  {
-    require Console::Color::Curses;
-    $setup{color} = 'Curses';
-  }
-  elsif ($^O eq 'MSWin32')
-  {
-    require Console::Color::Win32;
-    $setup{color} = 'Win32';
-  }
-  elsif ($fs)
-  {
-    # require Console::Color::Screen;  # TODO! needs to be written
-    require Console::Color::ANSI16;    # not a very general solution
-    $setup{color} = 'ANSI16';
-  }
-  else
-  {
-    require Console::Color::Mono;
-    $setup{color} = 'Mono';
-  }
+  require "Console/Color/$setup{color}.pm";
+}
+
+# This lets us do sub-second sleeps, if Time::HiRes is available.
+my $sleep = sub($) { sleep(shift); };
+my $found_time_hires = 0;
+foreach my $c (@INC)
+{
+  $found_time_hires = 1 if -r "$c/Time/HiRes.pm";
+}
+if ($found_time_hires) {
+  require Time::HiRes;
+  $sleep = sub($) { Time::HiRes::sleep(shift); };
+}
+sub vsleep($) {
+  &$sleep($_[0]);
 }
 
 1;

lib/console-virtual/README.markdown

+Console::Virtual
+================
+
+Version 2.0
+(c)2003-2013 Chris Pressey, Cat's Eye Technologies.  All rights reserved.  
+(BSD-style license.  See file `Console/Virtual.pm` for full license info.)
+
+What is Console::Virtual?
+-------------------------
+
+Console::Virtual is a lightweight, abstract, function-based (as opposed to
+object-oriented) Perl interface for accessing unbuffered keyboard input
+and an addressable screen display.  Together, these facilities are thought
+of as a 'virtual console,' regardless of what underlying technologies
+implement it.
+
+Console::Virtual is intended to be only a simple redirection layer that
+insulates the programmer from whatever screen-oriented mechanisms are
+actually installed at the site.
+
+On most modern systems, Perl's Curses module is usually installed, or easy
+to install via the package system, and for that reason, Console::Virtual
+defaults to using it as its backend.
+
+On some systems, though (and please understand this was more true when this
+interface was first written), Curses is impractical to install, or installed
+incorrectly.  Perl has other ways of working with an addressable screen,
+such as Term::Cap and Term::Screen (part of the Perl 5.8.8 core libraries),
+but they too on occasion are not installed correctly.  Further, they are
+lacking in abstraction -- they are based on the starting assumption of a
+Unix-like terminal interface.  Not all systems look at the world this way,
+Windows being one example.
+
+Because I was writing a console-based application which was to be highly
+portable, I needed a layer which would automatically decide which unbuffered-
+input and screen-addressing methods were appropriate for the site, and
+provide a small, simple, abstract, portable interface to delegate to those
+methods.
+
+Synopsis
+--------
+
+To use Console::Virtual, you will either have to install it somewhere in
+Perl's include path (you can do this by copying the Console directory and
+all of its contents to e.g. `/usr/local/lib/perl5/site_perl/5.005`), or
+alternately, give Perl a new include path which contains the Console
+directory.  As usual, there is more than one way to do this: you can
+pass the `-I` flag to the perl executable, or you can add a line like
+`BEGIN { push @INC, $dir }` to your script.  If you want to just keep the
+Console directory in the same directory as your script, you can add
+`BEGIN { use File::Basename; push @INC, dirname($0) }` instead.
+
+Then you can insert the following into your Perl script to use it:
+
+    use Console::Virtual 2.0
+         qw(getkey display gotoxy clrscr clreol
+            normal inverse bold color update_display
+            vsleep);
+
+Console::Virtual first tries to use Curses, if it's installed.  If not, and
+it detects that it's running on a Win32 system, it tries to use
+Win32::Console.  If not, it tries using Term::Screen if that's installed.
+If not, it then checks to see if POSIX is available, that TERM is set in the
+environment, and that /etc/termcap exists; if so, it uses POSIX raw input
+and it shells the external command `tput`, buffering the result, for output.
+
+Failing all of that, if Console::Virtual can't find anything that suits your
+platform, it will produce a warning, carry on regardless, and assume that it
+is running on a teletype.  It will emulate an addressable screen on the
+standard output stream the best way it knows how: the entire screen will be
+re-printed whenever an update is requested.  Also, the user will have to
+tolerate line-buffered input, where a carriage return must be issued before
+keystrokes will be responded to.  If this saddens you, be thankful that
+teletypes are rare these days.  (There are some of us who are frankly more
+saddened *by* the fact that teletypes are rare these days.)
+
+A specific input or display methodology can be specified by setting
+values in the `%Console::Virtual::setup` hash before using Console::Virtual.
+You probably shouldn't do this if you want to retain portability; the intent
+of it is to allow the end user to tailor their local copy of a script,
+forcing it to pick some specific implementation, presumably in preference to
+some other which would normally be preferred, but is (for whatever reason)
+not desired.  Note that when doing this, you can mix different regimens
+for input, display, and color; however, unless you know what you're doing,
+you probably shouldn't, as you're likely to get really weird results.
+See the code for more details.
+
+Any functions that you don't need to access can be left out of the qw()
+list.  In fact, the entire list can be omitted, in which case none of these
+names will be imported into your namespace.  In that case, you'll have to
+fully qualify them (like Console::Virtual::gotoxy()) to use them.
+
+Input Functions:
+
+    getkey()          wait for keystroke; don't wait for ENTER or echo
+
+Output Functions:
+
+    clrscr()          clear the screen
+    clreol()          clear to end of line
+    display(@list)    display all strings in @list at screen cursor
+    gotoxy($x,$y)     move the cursor to the 1-based (x,y) coordinate
+    bold()            set display style to bold
+    inverse()         set display style to inverted
+    normal()          set display style back to normal
+    update_display()  explicitly refresh the screen (Curses & Teletype need this)
+    color($f,$b)      sets the colors of text about to be displayed
+    vsleep($s)        sleep for $s seconds (may be a fraction)
+
+Acceptable arguments for $f and $b in color() are 'black', 'red', 'blue',
+'purple', 'green', 'brown', 'aqua', 'grey', 'pink', 'sky' (blue), 'magenta',
+'lime' (green), 'yellow', 'cyan', and 'white'.  Of course, not all terminals
+can display this many colors (or any color at all,) in which case color will
+be crudely approximated.
+
+Since the library is intended to be simple and abstract, that's all there is;
+nothing fancy enough to be severely broken, no capability predicates to check,
+no overkill object-oriented interface to follow.
+
+Differences with Term::Screen
+-----------------------------
+
+Console::Virtual is designed to be a (portable) abstraction layer, whereas
+Term::Screen is not.  There are several 'holes' in the interfaces provided
+by Term::Screen; that is, actions which are not prohibited as they probably
+ought to be.  In fact, last I checked, they are encouraged.
+
+These actions are prohibited in Console::Virtual.  Specifically, you should
+not simply use `print` to place text on the display device; you must instead
+use `display()`.  If you do not do this, the output of your program will look
+funny (to say the least) when the end user is using Curses, or a teletype,
+or some future output technology that Console::Virtual one day delegates to.
+By the same token, you must occasionally use `update_display()` for the
+benefit of Curses and other output regimens which require explicit refresh.
+Calling `update_display()` must be done when the cursor is to be seen, by
+the user, to move.  It is also a good idea to do it in anticipation of a
+long upcoming delay in the program (e.g. intense computation.)
+
+A Note on Version Numbers
+-------------------------
+
+There was a point in time when I thought `YYYY.MMDD` was the Only Version
+Number You'd Ever Need.  My opinion on that has changed.  Therefore, I am
+changing the version numbering for Console::Virtual; this is version 2.0.
+
+Alas, this plays havoc with logic that tries to decide which version of a
+package is more recent than another, as `2007.1122` > `2.0`.  However, there
+are two things that soften the blow:
+
+*   A local copy of this module ships with all Cat's Eye Technologies
+    projects that rely on it.
+*   I don't think anyone else actually uses this module.  Hooray!
+*   The `vsleep` function was introduced in 2.0.  To ensure that you
+    are really getting version 2.x or later, import `vsleep` in your
+    `use Console::Virtual 2.0`.
+
+But if you are saying `use Console::Virtual 2007.1122` in your script and
+you want to use the new 2.0 version, you will have to change the version
+number in that line.
+
+History
+-------
+
+-   v2001.0123: Renamed this module to _Console::Virtual.
+-   v2001.0124: fixed some namespace issues w.r.t. Win32.
+-   v2001.0127: added Color subfunctionality.
+-   v2003.0325: fixed up test.pl and readme.txt (no changes to code)
+-   v2007.1122: renamed to Console::Virtual, prettied readme.txt.
+    Also updated language in BSD license (no "REGENTS".)
+-   v2007.1122-YPSILAXDEV: made `die` turn off Curses before dying.
+    Converted README to Markdown.
+-   v2.0: added `vsleep`.  Did horrific thing to version number.
+
+More Information
+----------------
+
+The latest version of Console::Virtual can be found at:
+
+    https://github.com/catseye/Console-Virtual

lib/console-virtual/readme.txt

-Console::Virtual
-----------------
-
-v2007.1122 Chris Pressey, Cat's Eye Technologies.
-(c)2003-2007 Cat's Eye Technologies.  All rights reserved.
-(BSD-style license.  See file Console/Virtual.pm for full license info.)
-
-What is Console::Virtual?
--------------------------
-
-Console::Virtual is a lightweight, abstract, function-based (as opposed to
-object-oriented) Perl interface for accessing unbuffered keyboard input
-and an addressable screen display.  Together, these facilities are thought
-of as a 'virtual console,' regardless of what underlying technologies
-implement it.
-
-Console::Virtual is intended to be only a simple redirection layer that
-insulates the programmer from whatever screen-oriented mechanisms are
-actually installed at the site.  My experience has been that Curses is often
-not installed, or installed incorrectly.  It can be impractical to install,
-for any number of reasons.  While Term::Cap and Term::Screen are part of the
-Perl 5.8.8 core libraries, they too on occasion are not installed correctly.
-Further, they are insufficiently abstract, assuming that the user interacts
-with what is essentially a terminal.  Not all systems look at the world this
-way -- Windows machines being an obvious example.
-
-Because I was writing a console-based application which was to be highly
-portable, I needed a layer which would automatically decide which unbuffered-
-input and screen-addressing methods were appropriate for the site, and
-provide a small, simple, abstract, portable interface to delegate to those
-methods.
-
-Synopsis
---------
-
-To use Console::Virtual, you will either have to install it somewhere in
-Perl's include path (you can do this by copying the Console directory and
-all of its contents to e.g. /usr/local/lib/perl5/site_perl/5.005), or
-alternately, give Perl a new include path which contains the Console
-directory.  As usual, there is more than one way to do this: you can
-pass the -I flag to the perl executable, or you can add a line like
-BEGIN { push @INC, $dir } to your script.  If you want to just keep the
-Console directory in the same directory as your script, you can add
-BEGIN { use File::Basename; push @INC, dirname($0) } instead.
-
-Then you can insert the following into your Perl script to use it:
-
-  use Console::Virtual 2007.1122
-       qw(getkey display gotoxy clrscr clreol
-          normal inverse bold color update_display);
-
-Console::Virtual first tries to use Curses, if it's installed.  If not, and
-it detects that it's running on a Win32 system, it tries to use
-Win32::Console.  If not, it tries using Term::Screen if that's installed.
-If not, it then checks to see if POSIX is available, that TERM is set in the
-environment, and that /etc/termcap exists; if so, it uses POSIX raw input
-and it shells the external command `tput`, buffering the result, for output.
-
-Failing all of that, if Console::Virtual can't find anything that suits your
-platform, it will produce a warning, carry on regardless, and assume that it
-is running on a teletype.  It will emulate an addressible screen on the
-standard output stream the best way it knows how: the entire screen will be
-re-printed whenever an update is requested.  Also, the user will have to
-tolerate line-buffered input, where a carriage return must be issued before
-keystrokes will be responded to.  If this saddens you, be thankful that
-teletypes are rare these days.  (There are some of us who are frankly more
-saddened *by* the fact that teletypes are rare these days.)
-
-A specific input or display methodology can be specified by setting
-values in the %Console::Virtual::setup hash before using Console::Virtual.
-You probably shouldn't do this if you want to retain portability; the intent
-of it is to allow the end user to tailor their local copy of a script,
-forcing it to pick some specific implementation, presumably in preference to
-some other which would normally be preferred, but is (for whatever reason)
-not desired.  Note that when doing this, you can mix different regimens
-for input, display, and color; however, unless you know what you're doing,
-you probably shouldn't, as you're likely to get really weird results.
-See the code for more details.
-
-Any functions that you don't need to access can be left out of the qw()
-list.  In fact, the entire list can be omitted, in which case none of these
-names will be imported into your namespace.  In that case, you'll have to
-fully qualify them (like Console::Virtual::gotoxy()) to use them.
-
-Input Functions:
-
-  getkey()          wait for keystroke; don't wait for ENTER or echo
-
-Output Functions:
-
-  clrscr()          clear the screen
-  clreol()          clear to end of line
-  display(@list)    display all strings in @list at screen cursor
-  gotoxy($x,$y)     move the cursor to the 1-based (x,y) coordinate
-  bold()            set display style to bold
-  inverse()         set display style to inverted
-  normal()          set display style back to normal
-  update_display()  explicitly refresh the screen (Curses & Teletype need this)
-  color($f,$b)      sets the colors of text about to be displayed
-
-Acceptable arguments for $f and $b in color() are 'black', 'red', 'blue',
-'purple', 'green', 'brown', 'aqua', 'grey', 'pink', 'sky' (blue), 'magenta',
-'lime' (green), 'yellow', 'cyan', and 'white'.  Of course, not all terminals
-can display this many colors (or any color at all,) in which case color will
-be crudely approximated.
-
-Since the library is intended to be simple and abstract, that's all there is;
-nothing fancy enough to be severely broken, no capability predicates to check,
-no overkill object-oriented interface to follow.
-
-Differences with Term::Screen
------------------------------
-
-Console::Virtual is designed to be a (portable) abstraction layer, whereas
-Term::Screen is not.  There are several 'holes' in the interfaces provided
-by Term::Screen; that is, actions which are not prohibited as they probably
-ought to be.  In fact, last I checked, they are encouraged.
-
-These actions are prohibited in Console::Virtual.  Specifically, you should
-not simply use 'print' to place text on the display device; you must instead
-use display().  If you do not do this, the output of your program will look
-funny (to say the least) when the end user is using Curses, or a teletype,
-or some future output technology that Console::Virtual one day delegates to.
-By the same token, you must occasionally use update_display() for the
-benefit of Curses and other output regimens which require explicit refresh.
-Calling update_display() must be done when the cursor is to be seen, by
-the user, to move.  It is also a good idea to do it in anticipation of a
-long upcoming delay in the program (e.g. intense computation.)
-
-History
--------
-
-v2001.0123: Renamed this module to _Console::Virtual.
-v2001.0124: fixed some namespace issues w.r.t. Win32.
-v2001.0127: added Color subfunctionality.
-v2003.0325: fixed up test.pl and readme.txt (no changes to code)
-v2007.1122: renamed to Console::Virtual, prettied readme.txt.
-            Also updated language in BSD license (no "REGENTS".)
-
-More Information
-----------------
-
-The latest version of Console::Virtual can be found at:
-
-  http://catseye.webhop.net/projects/cons_virt/
-
-Chris Pressey
-November 22, 2007
-Chicago, Illinois, USA

lib/console-virtual/test.pl

 #!/usr/bin/perl -w
-# test.pl - test program for Console::Virtual
-# v2007.1122 Chris Pressey, Cat's Eye Technologies
-
-# Copyright (c)2000-2007, Chris Pressey, Cat's Eye Technologies.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-#  1. Redistributions of source code must retain the above copyright
-#     notices, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notices, this list of conditions, and the following disclaimer in
-#     the documentation and/or other materials provided with the
-#     distribution.
-#  3. Neither the names of the copyright holders nor the names of their
-#     contributors may be used to endorse or promote products derived
-#     from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
-# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# test.pl - test program for Console::Virtual v2.0
+# By Chris Pressey, Cat's Eye Technologies.
+# This work is in the public domain.
 
 # This line allows us to have the Console directory in the same
 # directory as the test script.
 # BEGIN { $Console::Virtual::setup{input} = 'POSIX'; $Console::Virtual::setup{display} = 'Tput'; }
 # BEGIN { $Console::Virtual::setup{input} = 'Teletype'; $Console::Virtual::setup{display} = 'Teletype'; }
 
-use Console::Virtual 2001.0127 qw(getkey display gotoxy clrscr clreol
-                                  normal inverse bold update_display);
+use Console::Virtual 2.0 qw(getkey display gotoxy clrscr clreol
+                            normal inverse bold update_display);
 
 clrscr;
 gotoxy(10,20);
 update_display;
 
 ### END of test.pl ###
-
 # BEGIN { $Console::Virtual::setup{input} = 'Teletype'; }
 # BEGIN { $Console::Virtual::setup{color} = 'ANSI16'; }
 
-use Console::Virtual 2007.1122
+use Console::Virtual 2.0
      qw(getkey display gotoxy clrscr clreol
-        normal inverse bold update_display color);
-
-# This lets us do sub-second sleeps, if Time::HiRes is available.
-my $sleep = sub($) { sleep(shift); };
-my $found_time_hires = 0;
-foreach my $c (@INC)
-{
-  $found_time_hires = 1 if -r "$c/Time/HiRes.pm";
-}
-if ($found_time_hires) {
-  require Time::HiRes;
-  $sleep = sub($) { Time::HiRes::sleep(shift); };
-}
+        normal inverse bold update_display color
+        vsleep);
 
 ### GLOBALS ###
 
     exit(0);
   }
   update_display();
-  &$sleep($delay / 1000);
+  vsleep($delay / 1000);
 }
 
 ### END of hunter.pl ###
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.