Chinku Simon wrote:
> 
> Hi,

Hello,

> I am facing an issue with the perl system command
> 
> The relevant lines of code are the following:
> 
> chdir "$util";
> my @args = ("ldapmodify", "-D \"cn=$bdn\"", "-w $bp", "-h $svr", "-f \"$ldif\"", 
> "-c", "-a");
>         system(@args) == 0 or die "system @args failed: $?";
> 
> The system call amounts to the following string:
> 
> system ldapmodify -D "cn=Directory Manager" -w infosys123 -h j-tdir1 -f
> d:\Netscape\Server4\slapd-j-cdcsm08\logs\modifications.ldif -c -a
> 
> It gives me the following error
> 
> d:\Netscape\Server4\slapd-j-cdcsm08\logs\modifications.ldif: Invalid argument
> system ldapmodify -D "cn=Directory Manager" -w infosys123 -h j-tdir1 -f
> d:\Netscape\Server4\slapd-j-cdcsm08\logs\modifications.ldif -c -a failed: 22784 at
> pwdmanagervss.pl line 407.
> 
> However, the ldapmodify command run from the command prompt works perfectly.

When using the system() function you can either pass it a list of
non-whitespace arguments or a single string containing all the
arguments.  Unfortunately some of the arguments in your list contain
whitespace.

chdir $util or die "Cannot chdir to $util: $!";
my @args = ( 'ldapmodify',
                 '-D', qq("cn=$bdn"),
                 '-w', $bp,
                 '-h', $svr,
                 '-f', qq("$ldif"),
                 '-c',
                 '-a'
                 );
system( @args ) == 0 or die "system @args failed: $?";



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to