This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see AnyEvent.pm for full source code | |
our $WAITING; | |
sub _wait { | |
$WAITING | |
and !$_[0]{_ae_sent} | |
and Carp::croak "AnyEvent::CondVar: recursive blocking wait detected"; | |
local $WAITING = 1; | |
AnyEvent->one_event while !$_[0]{_ae_sent}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use AnyEvent::CouchDB; | |
my $couch = couch('http://localhost:5984/'); | |
my $condvar = $couch->all_dbs; | |
my $data = $condvar->recv; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use common::sense; | |
use EV; | |
use AnyEvent; | |
use AnyEvent::CouchDB; | |
my $get_all_dbs = sub { | |
my $couch = couch('http://localhost:5984/'); | |
my $data = $couch->all_dbs->recv; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use common::sense; | |
use EV; | |
use AnyEvent; | |
use AnyEvent::Util; | |
use AnyEvent::CouchDB; | |
my @_queue = (); | |
my $_IS_RUNNING = 0; | |
sub _schedule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict qw(vars subs); | |
use feature qw(say state switch); | |
no warnings; | |
use warnings qw(FATAL closed threads internal debugging pack substr malloc | |
unopened portable prototype inplace io pipe unpack regexp | |
deprecated exiting glob digit printf utf8 layer | |
reserved parenthesis taint closure semicolon); | |
no warnings qw(exec newline); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use common::sense; | |
# anyevent uses any earlier preloaded event library | |
# if it can't find any then it uses it's own pure-perl code | |
use EV; | |
use AnyEvent; | |
use AnyEvent::Handle; | |
use AnyEvent::Socket; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package App; | |
use Moose; | |
use Moose::Util::TypeConstraints; | |
with 'MooseX::Getopt'; | |
use URI; | |
subtype 'Uri' | |
=> as 'Object' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package App::Role::Storage; | |
use MooseX::Role::Parameterized; | |
use Moose::Util::TypeConstraints; | |
use Class::MOP; | |
my %mapping = ( | |
YAML => [qw/Dump Load/], | |
JSON => [qw/to_json from_json/], | |
Storable => [qw/freeze thaw/] | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package App::TypesLibrary; | |
use URI; | |
use MooseX::Types -declare => [qw/ | |
Uri | |
/]; | |
# imports moose types | |
use MooseX::Types::Moose qw/Str Object/; | |
# note that syntax differs from the one when |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package App::Person; | |
use Moose; | |
use MooseX::Storage; | |
with Storage (format => 'JSON', io => 'File'); | |
has ['firstname', 'lastname'] => ( isa => 'Str' , is => 'rw' ); | |
package main; |
OlderNewer