Skip to content

Instantly share code, notes, and snippets.

@tempire
Created August 13, 2013 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tempire/6225765 to your computer and use it in GitHub Desktop.
Save tempire/6225765 to your computer and use it in GitHub Desktop.
use Modern::Perl;
use Mojo::UserAgent;
use Data::Dumper;
my $e = Event->new;
$e->on(
what => sub {
my $ua = Mojo::UserAgent->new;
$ua->get('http://127.0.0.1:3001' => sub { warn 55 });
warn 33;
}
);
$e->emit('what');
warn 44;
package Event;
use Mojo::Base 'Mojo::EventEmitter';
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment