# [Tex/LaTex] Perl File Missing from TeX Live on Windows (TeXcount)

perltexcounttexlivewindows

Trying to run TeXcount on Windows 7 with TeX Live results in

>texcount
Can't locate Win32/Console/ANSI.pm in @INC (@INC contains: C:/texlive/2013/tlpkg/tlperl/lib c:/texlive/2013/tlpkg/tlperl/lib .) at c:/texlive/2013/texmf-dist/scripts/texcount/texcount.pl line 11.
BEGIN failed--compilation aborted at c:/texlive/2013/texmf-dist/scripts/texcount/texcount.pl line 14
C:/texlive/2013/bin/win32/runscript.tlu:650: command failed with exit code 2:
perl.exe c:/texlive/2013/texmf-dist/scripts/texcount/texcount.pl


By searching for ansi.pm on Google, it appears that there are two Perl libraries called ansi.pm: one is for SQL, and the other (the relevant one) is for translating ANSI colour codes for the Windows console. I haven't been able to find the latter file on the internet.

You can find Win32::Console::ANSI at CPAN. I'm not enough of a Perl expert to tell if that would contain all you need, or if it would depend on which Perl installation you're using.

If it doesn't work, you'll just have to remove the inclusion of the package in TeXcount. In the latest version of TeXcount, the code to include the package is:

# Conditional package inclusion
if ($^O=~/^MSWin/) { eval { require Win32::Console::ANSI; Win32::Console::ANSI::->import(); }; if ($@) {
option_ansi_colours(0);
print STDERR 'Package Win32::Console::ANSI required for colour coded output.';
}
}


This should have captured the error given if the package is not available. However, if for some reason that doesn't happen, you can replace the entire block with the single line for turning of ANSI colours:

option_ansi_colours(0);


Of course, this means there will be no colour coding of the verbose output in the console, which makes it much less useful. Instead, you could then run TeXcount with the -html option to produce HTML code which you could then view in a browser.