Bonjour,

Je n'arrive pas à faire fonctionner fileevent. Je suis sous Windows. Je ne passe pas du tout dans la fonction action_lecture.

Quelqu'un aurait une idée ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
sub sauvegarde {
  my ($roText,$h) ;
  $f->destroy if Exists($f) ;
  $f = $mw->Frame(-background => 'white')->pack ;
  $roText = $f->Scrolled('ROText')->pack ;
 
 
  open $h, "perl boucle.pl|" or die "Echec tube $!";
 
  $mw->fileevent($h,'readable', [ \&action_lecture , $h , $roText ] ) ;
}
 
sub action_lecture {
  my ($h,$roText) = @_ ;
                                           print STDERR "ici\n" ;
                                           my $ligne = <$h> ;
                                           print 'Ligne lue : ' . $ligne ;
                                           $roText->insert('end',$ligne) ;
}
Merci