Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Slowing down perl for a response

Status
Not open for further replies.

FinnMan

Technical User
Feb 20, 2001
75
US
I have a perl script I'm writing to execute a system script that querys a LDAP server. I make a system call to the script ldapsearch and pass the password to it and then open a text file as an array that contains a list of account names to be queried.

When I run the script it comes back with:

"Can't exec "ldapscript": Argument list too long at ./script line 7.

Here's my script:
********************
#!/usr/bin/perl5.8.0 -w

open(IPF,&quot;<home1&quot;) or die &quot;Failed to open, $!&quot;;
@id=<IPF>;
$pass='password';
close(IPF);
system (&quot;ldapscript&quot;,$pass,@id);
**********************

Earlier I actuall had the &quot;close(IPF);&quot; line at the bottom of the script and would specify that it bombed somewhere around line 40,000. What do I need to do to make perl wait for a response on the query before continuing on?

Ultimately, I'm trying to grep for a particular response and then log those lines that match the pattern.

Thx!
 
Code:
#!/usr/bin/perl5.8.0 -w

open(IPF,&quot;<home1&quot;) or die &quot;Failed to open, $!&quot;;
$pass='password';
while (<IPF>) {
  system (&quot;ldapscript&quot;,$pass,$_);
}
close(IPF);
Would this be any better?
--Paul
 
Don't know why I didn't think of WHILE. :)

Thx!!
./FM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top