#!C:/Perl/bin/perl.exe #!/usr/bin/perl -I/home/hoge1e3/perlib use strict; use CGI::Carp qw(fatalsToBrowser); ### Configuration Section my $conf={ # Database db=>{ type=>'mysql', host=>'localhost', name=>'nohada', user=>'root', pass=>'root', }, # Server side apps serverApps => [qw(view jsonScript jsApp)], # log settings log => { type => 'file', fileName => '../logs/log', }, }; ### End of Configuration Section #Application calling sequence # GET http://path/to/system/?/ # GET http://path/to/system/?/ # equiv. to GET http://path/to/system/?view/ # POST http://path/to/system/ # with cmd= # ./index.cgi # * CMD_ARGS are in effect only if the application supports command-line-based invocation. BEGIN { push @INC,"perl"; push @INC,"perl/apps"; push @INC,"perl/alpha"; } use NConfig; use Arguments; &NConfig::add($conf); my ($appName,$args)=&Arguments::getURLAppArgs; if ($appName eq '') { if($ENV{REQUEST_METHOD} eq 'POST') {$appName="jsonScript";} else {$appName="view";} } my @apps=@{&NConfig::get("serverApps")}; for (@apps) { if ($appName eq $_) { $appName =~ s/[^\w\d]//g; print STDERR "EXEC: $appName\n"; eval ("use $appName;"); if ($@) {die("When use $appName: $@");} exit; } } die ("$appName: Command not found : [$ENV{QUERY_STRING}]");