Hello Brian, Thanks for your reply In fact, I wanna create a pool of connections in order to read articles from one of these, like this :
sub create_connections { for (my $i = 1 ; $i <= $max_connections ; $i++) { $all_connections[$i] = News::NNTPClient->new($best_ip, $port, $debug); if ($user) { $all_connections[$i]->authinfo($user, $password); }; $free_connections[$i] = 1; } } So when I want to read an article, I want to get the first free connection, but I dont succed in shared this array Sorry about but I didnt understand explaination about 'bless' and &share([]) prototyping because I'm a beginner Thanks a lot, Bobby --- Brian Raven <[EMAIL PROTECTED]> a écrit : > a b wrote: > > It's working with scalars variables but I want to > improve > > this by using an array (I wanna store 1..n > > connections) > > > > So I wanna found a tip to do it with > Threads::shared module > > or another one, > > From 'perldoc perlthrtut' (Shared And Unshared > Data): > > "In the case of a shared array, all the array's > elements are shared, ... > only simple values or references to shared variables > are allowed - this > is so that a private variable can't accidentally > become shared." > > From 'perldoc threads::shared' (BUGS): > > "bless is not supported on shared references. In the > current version, > bless will only bless the thread local reference and > the blessing will > not propagate to the other threads." > > This makes it really difficult to share objects > (which are blessed > references) between threads. Also threads are quite > new in Perl so you > should not assume that a module is thread safe > unless it is documented. > So your code is unlikely to work with threads until > Perl's threading > improves. > > Its difficult to suggest alternatives without > knowing what you are > trying to do, but you might have a look at POE. > > HTH > > -- > Brian Raven > > > > ----------------------------------------------------------------------- > The information contained in this e-mail is > confidential and solely > for the intended addressee(s). Unauthorised > reproduction, disclosure, > modification, and/or distribution of this email may > be unlawful. If you > have received this email in error, please notify the > sender immediately > and delete it from your system. The views expressed > in this message > do not necessarily reflect those of LIFFE Holdings > Plc or any of its subsidiary companies. > ----------------------------------------------------------------------- > > ___________________________________________________________________________ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs