On Thu, 8 Dec 2011 16:42:45 -0300 Tessio Fechine <oiss...@gmail.com> wrote:
> 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. > > --- > #!/usr/bin/perl -w > > use strict; > > # this fail as expected > # open my $search, "nonexistent-script.pl argument|" or die("error: $!\n"); > > # this does not > open my $search, "nonexistent-script.pl '(cn=peter*)'|" or die("error: > $!\n"); > > print "This should not appear.. but it does..\n"; The problem here I think is because the pipe-open spawns a shell which fails later on. Try this code: [CODE] #!/usr/bin/perl use strict; use warnings; open my $search, "nonexistent-script.pl '(cn=peter*)'|" or die("error: $!\n"); print "Foo\n"; if (!close($search)) { die "Close failed - $!"; } [/CODE] Here the close fails. Regards, Shlomi Fish > --- > > Thanks for your time. -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ http://www.shlomifish.org/humour/ways_to_do_it.html Chuck Norris read the entire English Wikipedia in 24 hours. Twice. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/