Re: Gtk2::Helper or Glib::IO event watcher problem
- From: "A. Pagaltzis" <pagaltzis gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Gtk2::Helper or Glib::IO event watcher problem
- Date: Tue, 22 Mar 2005 15:39:29 +0100
* 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]