Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Curses problem: initscr and endwin missing

by hsmyers (Canon)
on Feb 18, 2021 at 17:00 UTC ( [id://11128530] : perlquestion . print w/replies, xml ) Need Help??

hsmyers has asked for the wisdom of the Perl Monks concerning the following question:

Having successfuly installed Curses and Curses::GUI, I wrote the following test code;
#!/usr/bin/perl # test.pl -- use Modern::Perl '2020'; use utf8; no if $] >= 5.018, warnings => "experimental"; use open ':std', ':encoding(UTF-8)'; use autodie; use Curses; initscr; endwin;
That produces the following error message;
C:\Users\hsmyers\perl\two>test Curses function 'initscr' is not defined in your Curses library at C:\ +Users\hsmyers\perl\two\test.pl line 10.
if you comment out initscr; you get an nearly identical message;
C:\Users\hsmyers\perl\two>test Curses function 'endwin' is not defined in your Curses library at C:\U +sers\hsmyers\perl\two\test.pl line 11.
Just as a check I compiled the following with;
gcc curhello.c -lcurses #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <curses.h> int main(void) { WINDOW * mainwin; if ( (mainwin = initscr()) == NULL ) { fprintf(stderr, "Error initialising ncurses.\n"); exit(EXIT_FAILURE); } mvaddstr(13, 33, "Hello, world!"); refresh(); sleep(3); delwin(mainwin); endwin(); refresh(); return EXIT_SUCCESS; }
As I thought, it ran without a problem. This, in my mind, suggests that the successful installation of curses.pm, wasn't. All of this is in Windows 10, the most problematic perl playground. Since I've already done a great deal of coding using WSL/Ubuntu, I know that the same module has no problem in 'nix, just Windows. Does anyone have any suggestions?

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Replies are listed 'Best First'.
Re: Curses problem: initscr and endwin missing
by aitap (Curate) on Feb 18, 2021 at 19:44 UTC
    I once built the Curses distribution on Windows with PDCurses. I can't recover the details (the machine has been long retired), but it wasn't much harder than specifying the correct locations for the headers and the import library. The result was nice: I was able to run some Perl scripts with Curses, they seemed to behave well.
      My current plan A is to roll up my sleeves and tear apart the cpan Curses.pm module and see what makes it tick. I'm hoping for here is a plan B or C. I'm using PDCurses with a copied and renamed lib to libcurses. It makes compiling easier.

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
        Does it tell you anything useful if you run Makefile.PL with environment variable CURSES_VERBOSE set to a truthy value? It seems that all tests for existence of Curses functions somehow managed to fail.