diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-03-10 20:54:25 +0000 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-03-10 20:54:25 +0000 |
commit | 865dd759a0f14fea418124c2f90a1f7f928938af (patch) | |
tree | 9f02691a7d3d2fadf407a231a7fa4a90c0431a1e /include/nms | |
parent | fdabaaf3b2f513a9147d659e35c587f5104d6b7c (diff) |
NMS: Prep for frontend poller-rewrite
The biggest thing here is the addition of a generic poller and a generic
"hash" from the backend so equality can easily be checked.
Diffstat (limited to 'include/nms')
-rwxr-xr-x | include/nms/web.pm | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/nms/web.pm b/include/nms/web.pm index 184cd90..d22a060 100755 --- a/include/nms/web.pm +++ b/include/nms/web.pm @@ -7,6 +7,8 @@ use DBI; use Data::Dumper; use JSON; use nms; +use Digest::SHA qw(sha512_base64); +use FreezeThaw qw(freeze); package nms::web; use base 'Exporter'; @@ -62,10 +64,12 @@ sub setwhen { sub finalize_output { my $query; + my $hash = Digest::SHA::sha512_base64(FreezeThaw::freeze(%json)); $query = $dbh->prepare ('select ' . $now . ' as time;'); $query->execute(); $json{'time'} = $query->fetchrow_hashref()->{'time'}; + $json{'hash'} = $hash; printcc; print "Content-Type: text/jso; charset=utf-8\n\n"; |