in reply to Re: Weird screen output in my AceShell module
in thread Weird screen output in my AceShell module

Hmm, seens that I fooled myself little. Apparently I loaded that in some Constants.pm I've made. However, it still doesn't seem to work with the AceShell.pm module, even if I explicitly add this in the module:
# This so one can use \e ourselfes... on both Linux and Windows! Else # the Win32::Console::ANSI have its on functions for outputting in col +or! if ($^O eq "MSWin32") { eval { require Win32::Console::ANSI; }; } elsif ($^O eq "Linux") { eval { require Term::ANSIColor; }; } use Term::ANSIScreen qw/:color :cursor :screen :keyboard/; ...
After some testing, I seem to need to do this before loading in the Term::ANSIScreen module.

Replies are listed 'Best First'.
Re^3: Weird screen output in my AceShell module
by ikegami (Patriarch) on Jul 15, 2006 at 21:01 UTC
    elsif ($^O eq "Linux") { eval { require Term::ANSIColor; }; }

    is useless. You're using the functions from Term::ANSIScreen instead of those from Term::ANSIColor. Term::ANSIColor is a subset of Term::ANSIScreen, not the non-Windows equivalent of Win32::Console::ANSI.

    Furthermore, you can simplify your program using the if pragma:

    # Load ANSI driver if running in Windows. use if $^O eq 'MSWin32', 'Win32::Console::ANSI'; use Term::ANSIScreen qw/:color :cursor :screen :keyboard/; ...

    Using the simpler code shouldn't fix anything, but since it will load Win32::Console::ANSI at compile time as if you had said use Win32::Console::ANSI;, it might.

    Update: Added missing quotes as per reply.

      Ok, seems to be working now though. One thing I also noticed I missed was doing a function call like this: $self->functionCall() instead of just functionCall(); Stupid.

      Also, I get this with your code:
      Bareword "Win32::Console::ANSI" not allowed while "strict subs" in use at Constants.pm line 18.
      Execution of Constants.pm aborted due to compilation errors.
        oops, sorry, put it in quotes.