Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Prob Perl/Tk

Reply
Thread Tools

Prob Perl/Tk

 
 
Orion93
Guest
Posts: n/a
 
      02-17-2004
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!

 
Reply With Quote
 
 
 
 
Tulan W. Hu
Guest
Posts: n/a
 
      02-18-2004
"Orion93" <(E-Mail Removed)> 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 => [....]


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Audio prob that's more than a sound card prob LineOut Computer Support 2 04-19-2008 02:30 PM
aggravating wifi prob Robert Blackwell Wireless Networking 3 01-19-2005 05:20 PM
driver prob with dlink dwl 510 geepeetee Wireless Networking 0 10-09-2004 10:43 AM
Printer prob and also networking prob Gareth not NLL or anybody else. Computer Support 2 01-02-2004 07:48 PM
dataset update prob drishtik ASP .Net 1 09-12-2003 04:39 PM



Advertisments