/[synchroedit]/espi.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /espi.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Sun Apr 15 22:45:14 2007 UTC (17 years ago) by dpavlin
File size: 736 byte(s)
initial import of perl implementation of ESPI as
documented at http://wiki.synchroedit.com/index.php/ExternalServicePOSTInterface

1 dpavlin 1 #!/usr/bin/perl
2    
3     use strict;
4     use warnings;
5     use CGI;
6     use CGI::Carp 'fatalsToBrowser';
7    
8     use Data::Dump qw/dump/;
9    
10     $| = 1;
11    
12     my $espi_hook = {
13     # 'authenticate-user' => 'ACCESS GRANTED ADMIN',
14     # 'authenticate-user' => 'ACCESS GRANTED',
15     'authenticate-user' => sub {
16     my $param = shift;
17     warn "param = ",dump( $param );
18     my $ret = 'ACCESS GRANTED';
19     # $ret .= ' ADMIN';
20     return $ret;
21     }
22     };
23    
24     my $cgi = new CGI;
25    
26     print $cgi->header();
27    
28     my $v = $cgi->Vars;
29    
30     warn dump( $v );
31    
32     my $hook = $v->{espi_hook} || die "no espi_hook?";
33    
34     die "can't find hook for $hook" unless defined( $espi_hook->{ $hook } );
35    
36     if ( ref( $espi_hook->{ $hook } ) eq 'CODE' ) {
37     print $espi_hook->{ $hook }->( $v );
38     } else {
39     print $espi_hook->{ $hook }
40     };
41     print "\n";

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26