This file contains hidden or 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; | |
use warnings; | |
use AnyEvent; | |
use AnyEvent::HTTP; | |
use Promises 'deferred'; | |
my @urls = ( 'https://ddg.gg', 'http://dyndns.org', 'http://metacpan.org' ); | |
my $cv = AE::cv; | |
my $cb; $cb = sub { |
This file contains hidden or 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
# this function lets you run code in a fork | |
# and use a condvar on it to get the data | |
# and return it to the client in JSON form, all non-blocking and async | |
# based heavily on a trick by Assaf Gordon | |
sub async_response (&) { | |
my $cb = shift; | |
send_file( | |
\'noop', |
This file contains hidden or 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; | |
use warnings; | |
use DateTime; | |
my $dt = DateTime->new( | |
day => 13, | |
year => 2012, | |
); | |
my $count = 0; |
This file contains hidden or 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
.---------. | |
.----------.----------| Handler |--------.--------. | |
| | | '---------' | | | |
| | | | | | | |
| | | | | | | |
v v v '-> v v | |
.-----. .-----. .-----. .------------. .------. .-------. | |
| App | | App | | App | | Serializer | | Hook | | Route | | |
'-----' '-----' '-----' '------------' '------' '-------' |
This file contains hidden or 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 MusicPref; | |
use Moose; | |
use namespace::autoclean; | |
has 'name' => ( is => 'ro', isa => 'Str' ); | |
package Character; | |
use Moose; | |
use namespace::autoclean; | |
has 'name' => ( is => 'ro', isa => 'Str' ); | |
has 'music_prefs' => ( is => 'rw', does => 'KiokuDB::Set' ); |
NewerOlder