## File::CounterFile->lock(); ## should be $counter->lock(); $counter->inc; ## File::CounterFIle->unlock(); ## should be $counter->unlock(); #### .