0

I have a process that works in the production environment, that I need to get working on my local Windows 10 environment. It is a Perl script that calls mySql stored procedures.

I have installed ActivePerl 5.26.3 (64-Bit) from Active State. When I attempt to execute the script I get an error:

Can't locate DBD/mysql.pm (you may need to install the DBD::mysql module)...

So, I went to https://metacpan.org/release/DBD-mysql and found instructions that indicated I needed to do the following:

  1. perl -MCPAN -e shell
  2. install DBD::mysql

But, when I type the first command I get a message stating:

It looks like you don't have a C compiler and make utility installed. Trying to install dmake and the MinGW gcc compiler using the Perl Package Manager. This may take several minutes....

Then it goes thru what appears to be a successful installation. So I type in the second command. It scrolls by for a while, but ends with:

Failed during this command
DVEEDEN/DBD-mysql-4.050.tar.gz: writemakefile NO 'C:\Perl64\bin\perl.exe MakeFile.PL INSTALLDIRS=site' returned status 512

Not sure how to proceed.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Sammer
  • 145
  • 2
  • 11
  • 3
    Active Perl comes with its own package repository for CPAN packages that are precompiled. It should have ended up in your start menu somewhere. Install DBI and DBD::mysql from there. – simbabque Jul 25 '19 at 14:01
  • 2
    Active Perl doesn't give you a great environment for installing and building CPAN modules. I'd recommend using [Strawberry Perl](http://strawberryperl.com/) instead. – Dave Cross Jul 25 '19 at 14:07
  • simbabque - Looking at the Perl Package Manager I see that DBD-CSV, DBD-ODBC, DBD-Oracle, DBD-Pg, & DBD-SQLite are all installed. However, switching to All Packages does not include any additional DBD options.Also, it looks like DBI is already installed. – Sammer Jul 25 '19 at 14:18
  • Dave Cross - I have heard that Strawberry Perl is another option, but not for me. I need to replicate what production looks like. – Sammer Jul 25 '19 at 14:19
  • 1
    It looks like DBD-mysql [is available in PPM](https://code.activestate.com/ppm/DBD-mysql/) (honestly, I'd be stunned if it wasn't). So you just need to install it by [following these instructions](http://docs.activestate.com/activeperl/5.24/perl/faq/ActivePerl-faq2.html). – Dave Cross Jul 25 '19 at 14:27

1 Answers1

2

For ActivePerl, use their package manager PPM.

Or, use Strawberry Perl for a more unixy experience. It comes with all the stuff to compile and install modules.

No matter which Perl you use, on Windows or elsewhere, modules typically need to be compiled the same. Mixing compilers (such as Visual Studio and gcc) or options can lead to incompatible binaries. The same might happen across Perl versions too. That means to use the same Perl (and compilation method) for everything in your project).

The cpan utility doesn't figure out those things for you. It does whatever it's configured to do.

For what it's worth, the cpan method to install modules can be simpler:

$ cpan DBD::mysql
brian d foy
  • 129,424
  • 31
  • 207
  • 592
  • Thanks Brian, but still have issue. I used the cpan DBD::mysql command, results It looks like you don't have a C compiler and make utility installed. Trying to install dmake and the MinGW gcc compiler using the Perl Package Manager. ppm.bat install failed: Can't find any package that provides MinGW It looks like the installation of dmake and MinGW has failed. Can't locate Devel/CheckLib.pm in @INC (you may need to install the Devel::CheckLib module) (@INC contains: C:/Perl/site/lib C:/Perl/lib .) at Makefile.PL line 12. BEGIN failed--compilation aborted at Makefile.PL line 12. – Sammer Jul 25 '19 at 14:53
  • When I tried to install Devel::CheckLib I get a message: 'dmake' is not recognized as an internal or external command, operable program or batch file. – Sammer Jul 25 '19 at 14:58
  • If you are using ActivePerl, use ppm. What happened when you tried that? – brian d foy Jul 25 '19 at 18:15
  • In ppm when I look at installed packages I see DBD-ODBC, DBD-Oracle, etc. but no DBD-mySql. And going from installed apps to all apps does not seem to make a difference. I also tried clicking refresh as I move between all apps and installed apps, but it does not seem to make a difference. I do see in status Downloading ActiveState Package Repository packlist ... not found – Sammer Jul 25 '19 at 19:35
  • 1
    post new information in your original question, or ask a new one. Packages are case sensitive, and you want DBD::mysql (as I showed).https://code.activestate.com/ppm/DBD-mysql/ – brian d foy Jul 25 '19 at 22:13