* muppet <[EMAIL PROTECTED]> [2005-08-30 17:25]:
>   sub run_convert {
>       my $convert_command = shift;
> 
>       my $main_loop = Glib::MainLoop->new;
> 
>       my $pid = open CHILD, "$convert_command |"
>           or die "can't fork convert: $!";
> 
>       Glib::IO->add_watch (fileno CHILD, ['hup'], sub {
>           $main_loop->quit;
>           FALSE;
>       });
> 
>       $main_loop->run;
> 
>       close CHILD or warn "convert died with exit status ".($? >> 8)."\n";
>   }

Of course it would still be better if muppet could get into the
habit of using three-argument open() with lexical filehandles.
:-)

    sub run_convert {
        my @cmd = @_;
  
        my $main_loop = Glib::MainLoop->new;
  
        my $pid = open my $child, '-|', @cmd
            or die "can't fork convert: $!";
  
        Glib::IO->add_watch (fileno $child, ['hup'], sub {
            $main_loop->quit;
            FALSE;
        });
  
        $main_loop->run;
  
        close $child or warn "convert died with exit status ".($? >> 8)."\n";
    }


Pedantically promoting better Perl practices since ought one,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to