[Pmwiki-users] page revisions not working

Jonathan Scott Duff duff
Wed Oct 8 09:20:28 CDT 2003

On Wed, Oct 08, 2003 at 09:47:35AM -0500, Clinton R. Nixon wrote:
> $cmd = "/usr/bin/patch " . $q->param('txtfile') . " " .
> $q->param('patfile'); open (IN, "|$cmd");
> while (<IN>) {
>         $output .= $_;
> }
> close (IN);

This does not do what you think it does.    The entire while loop is
essentially a NOOP since you've opened the IN file handle as an
*output* pipe.

Why not just use system() from within perl?

	system "/usr/bin/patch", $q->param('txtfile'), $q->param('patfile');

And you should check the return value of your open() or system() to
see if it succeeded or not.

Jonathan Scott Duff
duff at lighthouse.tamucc.edu

More information about the pmwiki-users mailing list