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

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