Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot, bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon

Links

XODOX
Impressum

#1: "sprintf" is not recognized as an internal or external command,operable program or batch file.

Posted on 2011-04-07 00:11:25 by Leo Susanto

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=gcdmp-msql-mysql-modules@m .gmane.org

Report this message

#2: AW: "sprintf" is not recognized as an internal or external command, operable program or batch file.

Posted on 2011-04-07 10:12:03 by Gisbert.Selke

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.=20

\Gisbert

> -----Urspr=FCngliche Nachricht-----
> Von: Leo Susanto [mailto:leosusanto@gmail.com]=20
> Gesendet: Donnerstag, 7. April 2011 00:11
> An: perl@lists.mysql.com
> Betreff: 'sprintf' is not recognized as an internal or=20
> external command, operable program or batch file.
>=20
>=20
> Hi,
>=20
> 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."
>=20
> C:\CPANTesters\Perl5.10.0\cpan\build\DBD-mysql-4.018-d8v5HG> perl.exe
> Makefile.PL INSTALLDIRS=3Dsite --testuser=3Dcpantesters
> --testpassword=3Dcpantesters --testhost=3Dlocalhost
> '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=20
> - aborting ...
>=20
> I trace it down and this is the part of Makefile.PL that doesn't work.
>=20
> my $v;
> if ( defined $opt->{'testuser'} and defined=20
> $opt->{'testpassword'}) {
> $v =3D qx( sprintf('%s --user=3D%s --password=3D%s version',
> $mysqladmin , $opt->{'testuser'}, $opt->{'testpassword'}) );
> } else {
> $v =3D qx($mysqladmin version);
> }
>=20
> Taking the sprintf() out of qx() works.
>=20
> my $v;
> if ( defined $opt->{'testuser'} and defined=20
> $opt->{'testpassword'}) {
> my $line =3D sprintf('%s --user=3D%s --password=3D%s version',
> $mysqladmin , $opt->{'testuser'}, $opt->{'testpassword'});
> $v =3D qx( $line );
> } else {
> $v =3D qx($mysqladmin version);
> }
>=20
> I can reproduce this on the latest ActiveState Perl 5.12.3 (1204) too.
>=20
> --=20
> MySQL Perl Mailing List
> For list archives: http://lists.mysql.com/perl
> To unsubscribe: =20
> http://lists.mysql.com/perl?unsub=3Dgisbert.selke@wido.bv.ao k.de
>=20
>=20

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org

Report this message

#3: Re: "sprintf" is not recognized as an internal or external command,operable program or batch file.

Posted on 2011-04-08 17:49:46 by David Nicol

looks like you found a perfectly workable solution. Here's a more
complex way to do it without a named temporary variable:

à à à$v =3D qx( @{[sprintf('%s --user=3D%s --password=3D%s =
version',
$mysqladmin , $opt->{'testuser'}, $opt->{'testpassword'}) ]} )


That's an instance of

qq/ @{[ code goes here ]} /

which is a very handy idiom in my experience, except of course when
you want to run the code in scalar (not array) context, in which case
the approach can be adapted in any of several ways, but usually at
that point I'll use a named temporary.

On Wed, Apr 6, 2011 at 5:11 PM, Leo Susanto <leosusanto@gmail.com> wrote:

> [ Huh? ]
> à à à à$v =3D qx( sprintf('%s --user=3D%s --password=
=3D%s version',
> $mysqladmin , $opt->{'testuser'}, $opt->{'testpassword'}) );
> [ doesn't DWIM.]


--=20
"If people let the government decide what foods they eat and what
medicines they take, their bodies will soon be in as sorry a state as
the souls who live under tyranny." -Thomas Jefferson (1778) (via Paleo
Approved fb feed)

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org

Report this message