1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| #!/usr/local/bin/perl -w
#chomp ($saisie = <STDIN>);
#print $saisie;
use warnings;
use strict;
use Tk;
use Tk::NoteBook;
my @liste;
my $codebarre;
sub subone {
open OUT, ">>log.txt" or die;
open IN, "+>liste.txt" or die;
while ( my $line = <IN> ) {
chomp $line;
#my @liste=<IN>;
@liste = $line;
}
if ("@liste" =~ /$codebarre/){
print OUT $codebarre; # Inscription dans le fichier log/data/archive
my $popup = MainWindow->new( -title => 'CONFIRMATION' );
$popup->Label( -text => "Le code-barre $codebarre, fait bien partie du prêt inter-bibliothèques",)->pack();
MainLoop;
$codebarre=~ s/$codebarre//;
}
else {
my $popneg = MainWindow->new( -title => 'N° INCONNU' );
$popneg->Label( -text => "\n\nLe code-barre : $codebarre,\nne fait pas encore partie du prêt inter-bibliothèques.\n\nIl est donc ajouté.\n\n",)->pack();
MainLoop;
@liste = $codebarre;
print IN @liste;
}
close IN;
close OUT;
return;
}
my $fenetre_principale = MainWindow->new( -title => 'onglet', -background => 'yellow', );
$fenetre_principale->minsize ( 300, 300);
$fenetre_principale->Label ( -text => "Prêt inter-bibliothèques",)->pack();
# blocnote
my $blocnote = $fenetre_principale->NoteBook(
-backpagecolor => 'white',
-inactivebackground => 'pink',
)->pack( qw/-fill both -expand 1/ );
# CREATION DES ONGLETS
my $controle = $blocnote->add("controle", -label => "Contrôle",);
my $ajout = $blocnote->add("ajout", -label => "Ajout",);
# ONGLET CONTROLE
$controle->Label( -text => "CONTRÔLE\n\nEntrer le code barre du document :",)->pack();
$controle->Label( -text => ' Code-barre : ')->pack( qw/ -side left/ );
$codebarre = $controle->Entry( )->pack( qw/ -side left/ );
$controle->Button(
-text => 'Valider',
-command => \&subone,
)->pack( qw/ -side left/ );
# ONGLET AJOUT
$ajout->Label( -text => "AJOUT\n\nEntrer le code barre du document :",)->pack();
$fenetre_principale->Button (
-text => 'Bouton fermeture',
-command => sub { exit; },
)->pack();
MainLoop; |
Partager