Win32::Console::Curses thoughts

osfameron on 2003-07-31T14:04:31

Briefly thinking about this. Curses.pm is implemented as a wrapper around C functions in a curses library. Under Win32, dada's suggested that Curses could be ported to Perl itself, e.g. targeting Win32::Console functions instead of an external C library. This would be much more portable (as Win32::Console is standard with ActiveState builds).

It should be easy to export the same constants as Curses.pm, with an AUTOLOAD to croak when it encounters a function that isn't yet implemented. To use a script that uses Curses under Windows, just edit the file and substitute in use Win32::Console::Curses.

But I don't like the idea of having to modify the script file itself. A lovely and not in the least evil trick would be to add "Win32/Console" to the environment variable PERL5LIB: now any use Curses directive will now look for it in that subdirectory!
Of course, as the package name isn't Curses, this wouldn't actually import anything. So we need a magic *Curses::import = \&import; line to alias the two import subroutines too...

Is this acceptable practise I wonder?