Skip to content

Instantly share code, notes, and snippets.

@rfox90
Created October 19, 2015 02:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfox90/d345b88b1c8d261bea89 to your computer and use it in GitHub Desktop.
Save rfox90/d345b88b1c8d261bea89 to your computer and use it in GitHub Desktop.
Simple example of an lametric endpoint in perl.
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use JSON;
my $json = JSON->new->pretty->allow_nonref;
my $q = CGI->new;
print $q->header('application/json');
my $response = {};
my @frames;
my $firstFrame = {};
$firstFrame->{index} = 0;
#Make the lamatric display the current time
$firstFrame->{text} = localtime;
$firstFrame->{icon} = "i753";
push(@frames,$firstFrame);
$response->{frames} = \@frames;
print $json->encode($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment