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?
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).
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.