CP - Code - _write-v1.cgi

#!/usr/bin/perl
use strict;
use warnings;
use lib "_util_lib";
use IO::Handle;
use Data::Dumper;
use HappyTrout::Util;
use JSON;
sanitize environment to protect system() call
$ENV{'PATH'} = '/usr/sbin:/usr/bin:/sbin:/bin';
parse/untaint CGI parameters
use CGI qw( :standard :push );
use CGI::Carp qw( fatalsToBrowser );
my $cgi = new CGI;
my $util = new HappyTrout::Util;
sub report() {
$| = 1;
print $cgi->header( -type=> 'text/html',
-charset=>'utf-8',
-status=>200);
my $fname = $cgi->param('logfile[fname]');
my $cid = $cgi->param('logfile[cid]');
my $msg = $cgi->param('logfile[msg]');

my @ret = $util->write( $fname, $cid, $msg );
print encode_json(\@ret);

exit 0;

}
report();
exit 0;