-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgpad.pl
executable file
·55 lines (45 loc) · 1.25 KB
/
gpad.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl
#
# G.P.A.D. = General Purpose Ajax Dispatcher
# XML::RPC on steroids 8-Q
#
# This was an idea to ease the development of small sites
# with AJAX. Very low usage at the moment, but maybe someone
# has interest in it.
#
# Copyright (c) by Oliver Falk <oliver@linux-kernel.at>, 2014
use strict;
use warnings;
use CGI qw/:standard/;
use FindBin;
use lib $FindBin::Bin . '/perl-lib';
use lib '/omd/sites/test/perl-lib/';
use lib '/omd/versions/1.10/lib/perl5/lib/perl5/';
use Template;
my $q = new CGI;
my $ajaxlet = param('ajaxlet');
my $request = param('request');
die "ERROR: Unable to process this request" unless ($ajaxlet && $request);
my $template = Template->new({
INCLUDE_PATH => ['_templates', '/omd/sites/test/perl-lib/'],
# PRE_PROCESS => 'header.tt2',
POST_CHOMP => 1,
PRE_CHOMP => 1,
TRIM => 1,
EVAL_PERL => 1,
INTERPOLATE => 0,
LOAD_PERL => 1,
});
# Always know who's asking us...
my $user = $ENV{REMOTE_USER} || $ENV{AUTHENTICATED_UID} || 'Unknown';
print header;
$template->process("gpad/$ajaxlet/$request.tt2", {
ENV => \%ENV,
q => $q,
user => $user,
param => sub { param(@_) },
});
if($template->error()) {
print start_html, '<pre>' . $template->error() . '</pre>' . end_html;
}
exit 0;