A question for you, how far does your program go before the Tcl error shows up? Devel::Trace

Reminds me of Re^3: TKX and closing windows (bug) ..

L'anana ne parlais pas .... so this is the way I'd structure the program to avoid any Tkx noise .... I don't see an use for Thread::Semaphore

#!/usr/bin/perl -- use strict; use warnings; use threads stack_size => 4096; use Thread::Queue; Main( @ARGV ); exit( 0 ); sub Main { my $maxJobs = 5; my $q = Threads::Queue->new; my @workers = map { threads->create( \&Worker, $q ) } 1 .. $maxJo +bs; my $prompter = threads->create( \&Prompter, $q, $maxJobs ); # job +pusher #~ $prompter->join; #~ $_->join for @workers; $_->join for threads->list; ## wait for prompter, workers } sub Prompter { require Tkx; ### important, only thread with tkx stuff my( $q, $maxJobs ) = @_; my( $date_fic, $date_mois ) = DateFicMois(); # Time::Piece, strfti +me ... whatever ... AddJob( $q, $fic, $source, $rep, $cas ); ... unless( $rep_fichiers ){ SignalNoMoreJobs( $q, $maxJobs ); die "Maybe Exit9() if your heart is set on it"; } ... AddJob( $q, $fic, $source, $rep, $cas ); ... SignalNoMoreJobs( $q, $maxJobs ); return; } sub AddJob { my $q = shift; $q->enqueue( [ @_ ] ); return; } sub SignalNoMoreJobs { my( $q, $maxJobs ) = @_; $q->enqueue( undef ) for 1 .. $maxJobs; return; } sub Worker { my( $q ) = @_; while( defined( my $ficArgs = $q->dequeue ) ) { recup_fic( @$ficArgs ); } return; }

As you can see, the more well named subs you have, the less comments you need

See also Ask - ask your users about stuff / ask-introduction.pod

You can use utf8 to signal to perl that your file is written in utf8, so you don't have to decode("utf8" all over the place

Also see Win32::Unicode::Native since I assume you're on win32 ... for unicode version of mkdir/open... so you don't have to encode("iso-8859-1" ...

Also, if you still need to encode("iso-8859-1" .... don't do it all over the place (repetition hurts your fingers), do it in one helper subroutine, say in recup_fic or MyMkdir ...

I would also consider  my $answer = YesNo( "question", "title" ); and  ReadThis( $msg, $title ); ... although  Info( $msg, $title ); sounds good .... there is a Ask::Tk, a Ask::Tkx should be only a few tweaks to that


In reply to Re^3: Threads and TCL DeleteInterpProc by Anonymous Monk
in thread Threads and TCL DeleteInterpProc by x-lours

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.