Skip to content

Instantly share code, notes, and snippets.

@EatMoreCode
EatMoreCode / ws.pl
Last active September 3, 2015 02:12
Websocket command line tool. Connects a websocket endpoint with STDIN/STDOUT.
#!/usr/bin/env perl
use Mojo::UserAgent;
use IO::Select;
use feature 'say';
my $ua = Mojo::UserAgent->new();
my $ep = shift;
my $s = IO::Select->new();
$s->add(\*STDIN);
@EatMoreCode
EatMoreCode / mojo_and_mqtt.pl
Created August 28, 2015 02:59
WebApp consuming MQTT messages and providing data via HTTP
#!/usr/bin/env perl
# ./mojo_and_mqtt.pl daemon
use Mojolicious::Lite;
use EV;
use AnyEvent;
use AnyEvent::MQTT;
my $mqtt = AnyEvent::MQTT->new;