Skip to content

Instantly share code, notes, and snippets.

@rfox90
Created October 19, 2015 02:55

Revisions

  1. @ProbablePrime ProbablePrime created this gist Oct 19, 2015.
    28 changes: 28 additions & 0 deletions clock.cgi
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/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);