The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Mysql::Locker - Safe way of locking and unlocking MySQL tables.


 use Mysql::Locker;

 # Create table locks
 my $locker = new Mysql::Locker($dbh,
                                {'Customers' => 'READ',
                                 'Articles' => 'WRITE'});

 # Execute some tricky statements here...

 # Locks are automically released when $locker goes out of scope.


Mysql::Locker is a simple class for safely using MySQL locks. Locks are created when you instantiate the class and are automatically released when the object goes out of scope (or when you call undef on the object). One situation where this class is useful is when you have persistent database connections such as in some mod_perl scripts and you want to be sure that locks are always released even when a script dies somewhere unexpectedly.


new ($dbh,$locks);

Returns a new Mysql::Locker object.


Version 1.00 2002-01-02

Initial version


Craig Manley


Copyright (C) 2001 Craig Manley <>. All rights reserved. This program is free software; you can redistribute it and/or modify it under under the same terms as Perl itself. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.