root/lang/javascript/nohada/index.cgi @ 19985

Revision 19985, 1.3 kB (checked in by hoge1e3, 5 years ago)

初期インポート。

Line 
1#!C:/Perl/bin/perl.exe
2#!/usr/bin/perl
3
4
5use strict;
6use CGI::Carp qw(fatalsToBrowser);
7
8### Configuration Section
9my $conf={
10# Database
11  db=>{
12     type=>'mysql', 
13     host=>'localhost',
14     name=>'nohada',
15     user=>'root',
16     pass=>'root',
17  },
18# Server side apps
19  serverApps => [qw(view jsonScript todo backup)]
20};
21### End of Configuration Section
22
23#Application calling sequence
24# GET  http://path/to/system/?<APPNAME>/<ARGS>
25# GET  http://path/to/system/?/<ARGS>
26#   equiv. to GET  http://path/to/system/?view/<ARGS>
27# POST http://path/to/system/
28#   with cmd=<ENCODED_JSON_SCRIPT>
29# ./index.cgi <APPNAME> <CMD_ARGS>
30#   * CMD_ARGS are in effect only if the application supports command-line-based invocation.
31
32BEGIN {
33  push @INC,"perl";
34}
35use NConfig;
36use Arguments;
37&NConfig::add($conf);
38my ($appName,$args)=&Arguments::getURLAppArgs;
39
40if ($appName eq '') {
41  if($ENV{REQUEST_METHOD} eq 'POST') {$appName="jsonScript";}
42  else {$appName="view";} 
43}
44my @apps=@{&NConfig::get("serverApps")};
45for (@apps) {
46  if ($appName eq $_) {
47    $appName =~ s/[^\w\d]//g;
48        print STDERR "EXEC: $appName\n";
49    eval ("use $appName;");
50        if ($@) {die($@);}
51        exit;
52  }
53}
54die ("$appName: Command not found : [$ENV{QUERY_STRING}]");
Note: See TracBrowser for help on using the browser.