IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage Perl Discussion :

Executer un script perl


Sujet :

Langage Perl

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 6
    Par défaut Executer un script perl
    Bonjour,

    mon script ne fonctionne plus
    le fichier resultat final est crée mais il reste vide. aucun fichier resultat_XXXXXX.txt ne sont crées. Quelqu'un peut'il m'aider svp ?

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    #!C:/Perl/bin/perl.exe
    use warnings;use strict;
     
    my @fic_stat = <"D:/Documents and Settings/M406742/Bureau/Simon/DB/XITI/Sem 10 07/stat*">;
     
     
    foreach my $fichier (@fic_stat){
      $fichier =~ /\/statXiti_(\d{4})(\d\d)\.txt/;
      my $date = "20${1}$2";
     
      my $fic = "resultat_" . "$date.txt";
     
      open F_ECRIRE,">>$fic" or warn "E/S : $!\n";
      open F_LIRE,"$fichier" or warn "E/S : $!\n";
     
      while(<F_LIRE>){
        s/^/$date = /;
        print F_ECRIRE;
      }
    }
    #*********** FIN TRAITEMENT **********#
    #
    # concateantion dans resultatfinal.txt
    open F_ECRIRE,">>resultatfinal.txt" or die "E/S : $!\n";
     
     
    my @fic_res = <"D:/Documents and Settings/M406742/Bureau/Simon/DB/XITI/Sem 10 07/resultat_*.txt">;
     
    foreach my $e(@fic_res){
      open F_LIRE,"$e" or warn "E/S : ICI $!\n";
      while(<F_LIRE>){
        print F_ECRIRE;
      }
      print F_ECRIRE "\n";
    }
    __END__

  2. #2
    Expert confirmé
    Avatar de Jedai
    Homme Profil pro
    Enseignant
    Inscrit en
    Avril 2003
    Messages
    6 245
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Avril 2003
    Messages : 6 245
    Par défaut
    Mets des balises CODE autour de tes scripts à l'avenir (bouton # dans l'éditeur de message du forum).

    Tu ne sembles pas avoir beaucoup essayé de repérer le bug. Il semble que ton script n'arrive pas à récupérer les fichiers stat, mais pour en être sûr il faudrait que tu vérifies quelle taille fait cette liste.

    --
    Jedaï

  3. #3
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 6
    Par défaut
    J'ai pourtant bien chercher le bug
    La liste de fichiers statXiti_XXXXXX.txt (statXiti_070305.txt, statXiti_070306.txt, statXiti_070307.txt...) contient environ 20 éléments. Effectivment, il n'arrive pas à récuperer ces fichiers pourtant le chemin d'accès est bon puisque le fichier résultatfinal.txt est crée (vide) dans le même répertoire (qui est le bon).

    Je suis un peu bloqué, je ne vois d'ou provient le problème...

  4. #4
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 6
    Par défaut
    Jai essayé en indiquant le nom exact d'un fichier de la liste de resultat. il met renvoi toujours un fichier vide...mais je pense qu'il trouve bien le fichier spécifié. jai un message a la compilation :
    E/S : No such file or directory
    readline() on closed filehandle F_LIRE at codetest.pl line 16.

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     
    #!C:/Perl/bin/perl.exe
    use warnings;use strict;
     
    my @fic_stat = <"D:/Documents and Settings/M406742/Bureau/Simon/DB/XITI/Log XiTi/statXiti_070413.txt">;
     
     
    foreach my $fichier (@fic_stat){
      $fichier =~ /\/statXiti_(\d{4})(\d\d)\.txt/;
      my $date = "20${1}$2";
     
      my $fic = "resultat_" . "$date.txt";
     
      open F_ECRIRE,">>$fic" or warn "E/S : $!\n";
      open F_LIRE,"$fichier" or warn "E/S : $!\n";
     
      while(<F_LIRE>){
        s/^/$date = /;
        print F_ECRIRE;
      }
    }
    #*********** FIN TRAITEMENT **********#
    #
    # concateantion dans resultatfinal.txt
    open F_ECRIRE,">>resultatfinal.txt" or die "E/S : $!\n";
     
     
    my @fic_res = <"D:/Documents and Settings/M406742/Bureau/Simon/DB/XITI/Log XiTi/resultat_*.txt">;
     
    foreach my $e(@fic_res){
      open F_LIRE,"$e" or warn "E/S : ICI $!\n";
      while(<F_LIRE>){
        print F_ECRIRE;
      }
      print F_ECRIRE "\n";
    }
    __END__
    #

  5. #5
    Nouveau membre du Club
    Inscrit en
    Mars 2007
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Mars 2007
    Messages : 6
    Par défaut
    voici quelques lignes de mon fichiers statXiti_070413.txt
    tous les fichiers ont cette structure...y aurait-il un problème avec les fichiers ou les retours à la ligne ?

    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
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    03:31:49 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_PCC&hl=3x31x49&idclient=1178076708866 VXML -
    03:31:50 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNT&hl=3x31x50&idclient=1178076708866 VXML -
    03:31:51 10.100.62.52 /hit.xiti s=241243&s2=1&p=GSM_reconnu&hl=3x31x51&idclient=1178076708866 VXML -
    03:31:57 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=3x31x57&idclient=1178076708866 VXML -
    04:13:51 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_PCC&hl=4x13x51&idclient=1178079231008 VXML -
    04:13:52 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNT&hl=4x13x52&idclient=1178079231008 VXML -
    04:13:53 10.100.62.52 /hit.xiti s=241243&s2=1&p=GSM_reconnu&hl=4x13x53&idclient=1178079231008 VXML -
    04:13:59 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=4x13x59&idclient=1178079231008 VXML -
    04:18:26 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_CLD&hl=4x18x26&idclient=1178079506854 VXML -
    04:18:27 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNT&hl=4x18x27&idclient=1178079506854 VXML -
    04:18:28 10.100.62.52 /hit.xiti s=241243&s2=1&p=GSM_reconnu&hl=4x18x28&idclient=1178079506854 VXML -
    04:18:33 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=4x18x33&idclient=1178079506854 VXML -
    04:22:23 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_PCC&hl=4x22x23&idclient=1178079743208 VXML -
    04:22:24 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNC&hl=4x22x24&idclient=1178079743208 VXML -
    04:22:25 10.100.62.52 /hit.xiti s=241243&s2=1&p=GSM_reconnu&hl=4x22x25&idclient=1178079743208 VXML -
    04:22:29 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=4x22x29&idclient=1178079743208 VXML -
    04:28:38 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_CLD&hl=4x28x38&idclient=1178080117941 VXML -
    04:28:39 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNT&hl=4x28x39&idclient=1178080117941 VXML -
    04:28:40 10.100.62.52 /hit.xiti s=241243&s2=1&p=GSM_reconnu&hl=4x28x40&idclient=1178080117941 VXML -
    04:28:45 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=4x28x45&idclient=1178080117941 VXML -
    04:30:35 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_PCC&hl=4x30x35&idclient=1178080235682 VXML -
    04:30:36 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNC&hl=4x30x36&idclient=1178080235682 VXML -
    04:30:37 10.100.62.52 /hit.xiti s=241243&s2=1&p=GSM_reconnu&hl=4x30x37&idclient=1178080235682 VXML -
    04:30:42 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=4x30x42&idclient=1178080235682 VXML -
    04:35:12 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_CLD&hl=4x35x12&idclient=1178080511232 VXML -
    04:35:13 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNT&hl=4x35x13&idclient=1178080511232 VXML -
    04:35:17 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=4x35x17&idclient=1178080511232 VXML -
    04:43:02 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_CLD&hl=4x43x2&idclient=1178080981773 VXML -
    04:43:03 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNT&hl=4x43x3&idclient=1178080981773 VXML -
    04:43:06 10.100.62.52 /hit.xiti s=241243&s2=1&p=transfere&hl=4x43x6&idclient=1178080981773 VXML -
    04:45:02 10.100.62.52 /hit.xiti s=241243&s2=1&p=vers_PCC&hl=4x45x2&idclient=1178081101626 VXML -
    04:45:03 10.100.62.52 /hit.xiti s=241243&s2=1&p=PNT&hl=4x45x3&idclient=1178081101626 VXML -

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. comment executer mon script perl
    Par specimen35 dans le forum Langage
    Réponses: 0
    Dernier message: 19/12/2007, 16h16
  2. Probleme d'execution de script perl via un script php
    Par Liline85 dans le forum Langage
    Réponses: 4
    Dernier message: 10/08/2007, 11h17
  3. Comment executer un script perl dans un script javascript ?
    Par Hamdi Hedhili dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 01/11/2006, 17h09
  4. comment executer un script perl svp?
    Par nico72 dans le forum Langage
    Réponses: 8
    Dernier message: 13/07/2005, 09h51
  5. Réponses: 4
    Dernier message: 16/07/2004, 09h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo