| 1 | package Net::Gnats::Command::LKDB; | ||||||||||
| 2 | 40 | ▶ | use parent 'Net::Gnats::Command'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 40 | ▶ | use strictures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 40 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 40 | $Net::Gnats::Command::LKDB::VERSION = '0.22'; | |||||||||
| 6 | } | ||||||||||
| 7 | 40 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 40 | ▶ | use Net::Gnats::Constants qw(CODE_OK CODE_CMD_ERROR CODE_GNATS_LOCKED); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | =head1 NAME | ||||||||||
| 12 | |||||||||||
| 13 | Net::Gnats::Command::LKDB | ||||||||||
| 14 | |||||||||||
| 15 | =head1 DESCRIPTION | ||||||||||
| 16 | |||||||||||
| 17 | Locks the main gnats database. No subsequent database locks will | ||||||||||
| 18 | succeed until the lock is removed. Sessions that attempt to write to | ||||||||||
| 19 | the database will fail. | ||||||||||
| 20 | |||||||||||
| 21 | =head1 PROTOCOL | ||||||||||
| 22 | |||||||||||
| 23 | LKDB | ||||||||||
| 24 | |||||||||||
| 25 | =head1 RESPONSES | ||||||||||
| 26 | |||||||||||
| 27 | The possible responses are: | ||||||||||
| 28 | |||||||||||
| 29 | 210 (CODE_OK) The lock has been established. | ||||||||||
| 30 | |||||||||||
| 31 | 440 (CODE_CMD_ERROR) One or more arguments were supplied to the | ||||||||||
| 32 | command. | ||||||||||
| 33 | |||||||||||
| 34 | 431 (CODE_GNATS_LOCKED) The database is already locked, and the lock | ||||||||||
| 35 | could not be obtained after 10 seconds. | ||||||||||
| 36 | |||||||||||
| 37 | 6xx (internal error) An internal error occurred, usually because of | ||||||||||
| 38 | permission or other filesystem-related problems. The lock may or may | ||||||||||
| 39 | not have been established. | ||||||||||
| 40 | |||||||||||
| 41 | =cut | ||||||||||
| 42 | |||||||||||
| 43 | 40 | my $c = 'LKDB'; | |||||||||
| 44 | |||||||||||
| 45 | 4 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 46 | 4 | my ( $class ) = @_; | |||||||||
| 47 | 4 | my $self = bless {}, $class; | |||||||||
| 48 | 4 | return $self; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 8 | ▶ | sub as_string { | ||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 52 | 8 | return $c; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 4 | ▶ | sub is_ok { | ||||||||
|
Subroutine
is_ok: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 56 | 4 | my $self = shift; | |||||||||
| 57 | 4 | ▶ | return 1 if $self->response->code == CODE_OK; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 3 | return 0; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 40 | 1; | |||||||||