List:MySQL and Perl« Previous MessageNext Message »
From:Gisbert W. Selke Date:April 7 2011 8:12am
Subject:AW: 'sprintf' is not recognized as an internal or external command, operable program or batch file.
View as plain text  
Hi Leo --

The qx operator, according to the Perl docs, takes "A string which is (possibly)
interpolated and then executed as a system command with /bin/sh or its equivalent". So
you're asking your shell to do a sprintf. Since you seem to be working under Windows,
this is equivalent to you typing "sprintf(blah)" at the Windows (aka "DOS") command
prompt (try it!). The error message you get has nothing to do with Perl at all, it's just
that you're asking your shell something that the shell does not know how to do.

In any case, it's probably not what you want to do anyway. What you want to do is what you
describe in the second part of your mail. And that does work indeed, as you say. 

\Gisbert

> -----Ursprüngliche Nachricht-----
> Von: Leo Susanto [mailto:leosusanto@stripped] 
> Gesendet: Donnerstag, 7. April 2011 00:11
> An: perl@stripped
> Betreff: 'sprintf' is not recognized as an internal or 
> external command, operable program or batch file.
> 
> 
> Hi,
> 
> I am trying to make the makefile with the option of inserting
> testuser, testpassword and testhost into "perl.exe Makefile.PL"
> command line, but I keep getting "'sprintf' is not recognized as an
> internal or external command, operable program or batch file."
> 
> C:\CPANTesters\Perl5.10.0\cpan\build\DBD-mysql-4.018-d8v5HG>perl.exe
> Makefile.PL INSTALLDIRS=site --testuser=cpantesters
> --testpassword=cpantesters --testhost=localhost
> 'sprintf' is not recognized as an internal or external command,
> operable program or batch file.
> Problem running C:\CPANTE~1\bin\MYSQL-~1.11-\bin\MYSQLA~1.EXE 
> - aborting ...
> 
> I trace it down and this is the part of Makefile.PL that doesn't work.
> 
>     my $v;
>     if ( defined $opt->{'testuser'} and defined 
> $opt->{'testpassword'}) {
>         $v = qx( sprintf('%s --user=%s --password=%s version',
> $mysqladmin , $opt->{'testuser'}, $opt->{'testpassword'}) );
>     } else {
>         $v = qx($mysqladmin version);
>     }
> 
> Taking the sprintf() out of qx() works.
> 
>     my $v;
>     if ( defined $opt->{'testuser'} and defined 
> $opt->{'testpassword'}) {
>         my $line = sprintf('%s --user=%s --password=%s version',
> $mysqladmin , $opt->{'testuser'}, $opt->{'testpassword'});
>         $v = qx( $line );
>     } else {
>         $v = qx($mysqladmin version);
>     }
> 
> I can reproduce this on the latest ActiveState Perl 5.12.3 (1204) too.
> 
> -- 
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe:    
> http://lists.mysql.com/perl?unsub=1
> 
> 
Thread
'sprintf' is not recognized as an internal or external command,operable program or batch file.Leo Susanto7 Apr
  • AW: 'sprintf' is not recognized as an internal or external command, operable program or batch file.Gisbert W. Selke7 Apr
  • Re: 'sprintf' is not recognized as an internal or external command,operable program or batch file.David Nicol8 Apr