| 1 | package Protocol::Redis::XS; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use parent "Protocol::Redis"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use XS::Object::Magic; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use XSLoader; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.10'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | XSLoader::load "Protocol::Redis::XS", $VERSION; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 3 | my($class, %args) = @_; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 3 | my $on_message = delete $args{on_message}; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | Carp::croak(qq/Unknown Protocol::Redis API version $args{api}/) | ||||||||||||||||||||||||||||
| 19 | 3 | ▶ | unless defined $args{api} and $args{api} == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $args{"api"} and $args{"api"} == 1
MC/DC50%1/2
defined $args{"api"} and $args{"api"} == 1
defined $args{"api"}
$args{"api"} == 1
Truth table66%2/3
A and B
A= defined $args{"api"}B= $args{"api"} == 1
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | my $self = bless \%args, $class; | |||||||||||||||||||||||||||
| 22 | 2 | ▶ | $self->on_message($on_message) if defined $on_message; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 2 | $self->_create; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 2 | return $self; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | # See Protocol::Redis for description of the API versioning | ||||||||||||||||||||||||||||
| 30 | 1 | ▶ | sub api { | ||||||||||||||||||||||||||
|
Subroutine
api: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 1 | my($self) = @_; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | $self->{api}; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 5 | ▶ | sub on_message { | ||||||||||||||||||||||||||
|
Subroutine
on_message: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 37 | 5 | my($self, $cb) = @_; | |||||||||||||||||||||||||||
| 38 | 5 | $self->{_on_message_cb} = $cb; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 2 | 1; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | __END__ | ||||||||||||||||||||||||||||