tags:

views:

176

answers:

2

I'm trying to parse a MYSQL slow query log from the command line.

Upon entering this:

set PATH=G:\xampp\perl\bin\;%PATH%
cd /d G:\xampp\mysql\scripts
perl mysqldumpslow.pl -s c -t 10

The shell returns an error can't locate strict.pm in @INC (@INC contains: .) at mysqldumpslow.pl at line 8. BEGIN failed

In the perl directory in xampp, there is only one file perl.exe.

Am I missing perl modules/libraries? What do I need to read this log file?

+2  A: 

Your Perl installation seems to have been messed up in one way or another. I am not familiar with xampp, but I have a hard time believing they bundled just the perl.exe without the rest of the distribution.

Under G:\xampp\perl, there should be subdirectories such as lib, site etc.

strict is a core pragma and its absence indicates that you do not have a proper Perl installation.

In fact, I just downloaded xampp and it does contain lib and site\lib under xampp\perl (it is missing the documentation, but that is not essential to running Perl scripts).

Sinan Ünür
+2  A: 

A workaround is to find the location of strict.pm in your perl installation and to add the directory to the PERL5LIB environment variable, or to invoke perl with the -I/path/to/strict.pm/directory option (see perlfaq8: How do I add a directory to my include path (@INC) at runtime?).

If you find more unsatisfied dependencies, keep adding directories to PERL5LIB or with additional -I options until your program can run.

(Though eventually you will probably get tired of this and fix/reinstall perl.)

UPDATE: Looking through the 1.7.3 XAMPP distribution, all of the perl library files are located under xampp\perl\lib and xampp\perl\site\lib, so

    perl -IG:/xampp/perl/lib -IG:/xampp/perl/site/lib mysqldumpslow.pl -s c -t 10

is probably all that you need to do. YMMV if you have an older XAMPP distribution.

mobrule
I'm running 1.7.0 Any recommendations. Do people really write YMMV? I'm so out of touch with these acronymns. :)
rrrfusco
Prior to 1.7.2, perl was an "add-on" to XAMPP, but the directory structure (\perl\bin, \perl\lib, \perl\site\lib) is the same. Reinstall if you don't have those directories.
mobrule