in reply to Sharing a Thread::Semaphore among threads

Due to Perl's prototyping "problem", when you want to share a reference to an object, you need to do something like:

my $s = &shared( Thread::Semaphore->new );

Note that you don't have to initialize the semaphore with counter of 1, because it is set to 1 by default.