Created
October 19, 2015 02:55
-
-
Save rfox90/d345b88b1c8d261bea89 to your computer and use it in GitHub Desktop.
Simple example of an lametric endpoint in perl.
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
#!/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