diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-05-10 21:55:40 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-05-10 21:55:40 +0200 |
| commit | 8a6ae158a03dc0fd678954e9db265a09f9841e09 (patch) | |
| tree | 4136d8dce17525344202e4e7a66bc03f3ca6dadd /lib/AnyEvent/Riak/Role/CVCB.pm | |
| parent | class for bucket and object (diff) | |
| download | anyevent-riak-8a6ae158a03dc0fd678954e9db265a09f9841e09.tar.gz | |
some roles
Diffstat (limited to '')
| -rw-r--r-- | lib/AnyEvent/Riak/Role/CVCB.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/AnyEvent/Riak/Role/CVCB.pm b/lib/AnyEvent/Riak/Role/CVCB.pm new file mode 100644 index 0000000..74684c2 --- /dev/null +++ b/lib/AnyEvent/Riak/Role/CVCB.pm @@ -0,0 +1,27 @@ +package AnyEvent::Riak::Role::CVCB; + +use Moose::Role; + +sub default_cb { + my ($self, $options) = @_; + return sub { + my $res = shift; + return $res; + }; +} + +sub cvcb { + my ($self, $options) = @_; + + my ($cv, $cb); + $cv = AE::cv; + if ($options->{callback}) { + $cb = delete $options->{callback}; + } + else { + $cb = $self->default_cb(); + } + ($cv, $cb); +} + +1; |
