Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

osfameron (3135)

osfameron
  (email not shown publicly)
http://greenokapi.net/blog/

Technorati Profile [technorati.com]

Journal of osfameron (3135)

Thursday July 31, 2003
09:04 AM

Win32::Console::Curses thoughts

[ #13808 ]
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 = \ line to alias the two import subroutines too...

Is this acceptable practise I wonder?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.