Re: Gtk2::Helper or Glib::IO event watcher problem



* muppet <scott asofyet org> [2005-03-22 14:40]:
  open(IN, q^perl -e '$|++; for($i=0;$i<10;$i++) { $sum+= $i; print 
"Line $i: sum = $sum\n"; sleep 1;}'|^)
       or die "Failed running perl subprocess\n";

Why's the FAQ using such old-style/C-ish Perl anyway? Something
like this would be better:

    open( my $pipe, '-|', perl => -e => q{
        $|++;
        for $i ( 0 .. 9 ) {
            $sum += $i;
            print "Line $i: sum = $sum\n";
            sleep 1;
        }
    } ) or die "Failed running perl subprocess\n";

and then substitute all occurences of "IN" with "$pipe" in the
rest of the code.

There are more cases of two-arg open.

Is there a way to send a patch for the FAQ or is it unavoidable
to be an annoyance if one wants it fixed? :-)

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]