open&run zahada

Honza Pazdziora adelton na informatics.muni.cz
Čtvrtek Červenec 27 18:35:27 MEST 2000


On Thu, Jul 27, 2000 at 06:17:07PM +0200, Milan Sorm wrote:

> evalem. Hmm. Ale v man perlfunc je to popsane jinak nez se to chova.

perldoc -f open rika

             If the filename begins with '|', the filename is
             interpreted as a command to which output is to be
             piped, and if the filename ends with a '|', the
             filename is interpreted See the section on Using
             open() for IPC in the perlipc manpage for more
             examples of this.

a v perlipc se explicitne pise

     Be careful to check both the open() and the close() return
     values.  If you're writing to a pipe, you should also trap
     SIGPIPE.  Otherwise, think of what happens when you start up
     a pipe to a command that doesn't exist: the open() will in
     all likelihood succeed (it only reflects the fork()'s
     success), but then your output will fail--spectacularly.
     Perl can't know whether the command worked because your
     command is actually running in a separate process whose
     exec() might have failed.  Therefore, while readers of bogus
     commands return just a quick end of file, writers to bogus
     command will trigger a signal they'd better be prepared to
     handle.  Consider:

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


Další informace o konferenci Perl