Prob Perl/Tk

Discussion in 'Perl Misc' started by Orion93, Feb 17, 2004.

  1. Orion93

    Orion93 Guest

    From the script below I try to make an interface in Perl/Tk to be able to
    choose the repertory directly. The initial script count lines for all pl
    files in one directory.

    Initial Script:
    #!/usr/bin/perl
    sub recupPages
    {
    my $nomFic = shift;
    my $result = shift;

    # Récupération des lignes du fichier
    open(F,$nomFic);
    open(SORTIE,">> $result");
    $i = 0;
    while(<F>)
    {
    $i ++;
    }
    print SORTIE " $nomFic $i\n";

    close F;
    close SORTIE;}

    my $emplacement = "e:\\Dossier_travail\\stat\\";
    my $ficResultat = "e:\\result.txt";
    recupPages($_, $ficResultat) for glob 'e:\\Dossier_travail\\stat\\*.pl';


    Current script:

    #!/usr/bin/perl
    use strict;
    use warnings;
    use Tk;
    use diagnostics;

    my $main = MainWindow -> new;
    $main -> title("Test 1");
    $main -> Label(-text=>"Chemin:")->pack();
    $main -> Entry()->pack(-padx=>5);
    $main->Button(-text=>'Ok',-command=>\my $recupPages)->pack(-side=>'left',
    expand=>1);
    $main->Button(-text=>"Fermer",-command=>sub {exit;})->pack(-side=>'right',
    expand=>1);
    MainLoop();

    sub recupPages
    {
    # my $rep= my $resupPages->get();
    my $result = shift;
    # Récupération des lignes du fichier
    open (F,"$recupPages");
    open (SORTIE,">> my $result");
    my $i = 0;
    while(<F>)
    {
    $i ++;
    }
    print SORTIE " my $recupPages $i\n";
    close F;
    close SORTIE;
    }
    #my $emplacement = @rep;
    my $ficResultat = "e:\\result.txt";
    recupPages($_, $ficResultat) for glob '$nomFic\*.pl';

    I don't understand where are my errors! Please Help me again!
     
    Orion93, Feb 17, 2004
    #1
    1. Advertising

  2. Orion93

    Tulan W. Hu Guest

    "Orion93" <> wrote
    [snip]
    > $main->Button(-text=>'Ok',-command=>\my $recupPages)->pack(-side=>'left',
    > expand=>1);

    ?????
    what is '-command=>\my $recupPages' ?
    check syntax.
    -command => sub {...}
    -command => &sub_name
    -command => [....]
     
    Tulan W. Hu, Feb 18, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. drishtik

    dataset update prob

    drishtik, Sep 9, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    637
  2. paraag

    vhdl 2 blif prob

    paraag, Feb 18, 2004, in forum: VHDL
    Replies:
    0
    Views:
    1,206
    paraag
    Feb 18, 2004
  3. Replies:
    8
    Views:
    5,105
    Charles Bailey
    Feb 12, 2005
  4. Nisheeth

    multiplication prob

    Nisheeth, Mar 31, 2005, in forum: VHDL
    Replies:
    1
    Views:
    648
    Jonathan Bromley
    Mar 31, 2005
  5. guru10

    Re: Prob. with EDK 3.2

    guru10, Aug 9, 2005, in forum: VHDL
    Replies:
    0
    Views:
    483
    guru10
    Aug 9, 2005
Loading...

Share This Page