*BSD News Article 93323


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!newsfeeds.sol.net!ix.netcom.com!gerg
From: gerg@netcom.com (Greg Andrews)
Subject: Re: perl script help
Message-ID: <gergE8GICn.J9q@netcom.com>
Organization:  Carpe Queso -- Seize the Cheese!
References: <5ijf34$b4r$1@nntp1.uunet.ca>
Date: Fri, 11 Apr 1997 04:41:11 GMT
Lines: 31
Sender: gerg@netcom23.netcom.com
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:38894


"James Leutri" <james@club-webb.com> writes:
>If somone could explain why this script will not execute the command on
>line 5 it would be greatly appreciated.
> Or if there is something else wrong? :).
>
>
>--- perl script begins ---
>#!/usr/bin/perl
>print "Content-type: text/html\n\n";
>&ReadParse;
>
>open(OUT, "| glimpse -l -y $in{'string'}");
>@result = <OUT>;

That last line is the fifth line in the file.  Is that the one
failing.

It certainly looks like it would fail.  It's trying to read from
a file descriptor that was opened on write-only mode.  Look at the
open() call just above it.  The '|' character is at the *front*
of the command in the second parameter.  You do that when you're
going to *write to* the command, not read from it.

Re-read the Perl man page that describes the open() function...

  -Greg
-- 
:::::::::::::::::::  Greg Andrews  gerg@netcom.com  :::::::::::::::::::
ObGuindon:  With the help of hypnosis, Claire Fuller was able
            to gain fifteen pounds in the last three weeks.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::