Front page | perl.beginners |
Postings from December 2011
Re: open bug?
Thread Previous
|
Thread Next
From:
John W. Krahn
Date:
December 8, 2011 13:11
Subject:
Re: open bug?
Message ID:
4EE12814.3080202@shaw.ca
Tessio Fechine wrote:
> Hello,
Hello,
> I have a perl script that uses Net::LDAP to query an directory service. It
> is invoked like this:
>
> ---
> search.pl '(cn=peter*)'
> ---
>
> Today I started another perl script that works on top of search.pl. It
> opens search.pl with a piped open, and them process the results.
> But I accidentally found that open acted oddly when '(cn=string*)' was
> passed to it.
> The possible bug is that when I pass a nonexistent file name fallowed by
> '(cn=string*)' to open, it do not fail.
It sounds like you have a problem with the shell, not with Perl. Try
invoking your search program without getting the shell involved:
open my $search, '-|', 'search.pl', '(cn=peter*)'
or die "Cannot open pipe from 'search.pl' because: $!";
Also be sure to close the piped filehandle correctly:
close $search or warn $! ? "Error closing 'search.pl' pipe: $!"
: "Exit status $? from 'search.pl'";
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
Thread Previous
|
Thread Next