| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Protocol::Redis::XS; | 
| 2 | 2 |  |  | 2 |  | 49832 | use strict; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 77 |  | 
| 3 | 2 |  |  | 2 |  | 10 | use warnings; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 74 |  | 
| 4 | 2 |  |  | 2 |  | 3349 | use parent "Protocol::Redis"; | 
|  | 2 |  |  |  |  | 1233 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 2 |  |  | 2 |  | 8733 | use XS::Object::Magic; | 
|  | 2 |  |  |  |  | 1667 |  | 
|  | 2 |  |  |  |  | 61 |  | 
| 7 | 2 |  |  | 2 |  | 12 | use XSLoader; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 430 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | our $VERSION = '0.05'; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | XSLoader::load "Protocol::Redis::XS", $VERSION; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub new { | 
| 14 | 2 |  |  | 2 | 1 | 1547 | my($class, %args) = @_; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 2 |  |  |  |  | 5 | my $on_message = delete $args{on_message}; | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 2 |  |  |  |  | 7 | my $self = bless \%args, $class; | 
| 19 | 2 | 50 |  |  |  | 9 | return unless $self->api == 1; | 
| 20 | 2 | 50 |  |  |  | 9 | $self->on_message($on_message) if defined $on_message; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 2 |  |  |  |  | 43 | $self->_create; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 2 |  |  |  |  | 8 | return $self; | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | # See Protocol::Redis for description of the API versioning | 
| 28 |  |  |  |  |  |  | sub api { | 
| 29 | 3 |  |  | 3 | 1 | 892 | my($self) = @_; | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 3 |  |  |  |  | 26 | $self->{api}; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub on_message { | 
| 35 | 5 |  |  | 5 | 1 | 852 | my($self, $cb) = @_; | 
| 36 | 5 |  |  |  |  | 14 | $self->{_on_message_cb} = $cb; | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | 1; | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | __END__ |