diff public_html/cgi-bin/_config.pm @ 0:aac1085b256d

initial commit
author cin
date Sat, 15 Mar 2014 00:34:33 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/cgi-bin/_config.pm	Sat Mar 15 00:34:33 2014 +0400
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+use File::Spec;
+use Carp;
+
+my @dirs;
+
+BEGIN {
+	$Carp::Verbose = 0; # set this to 1 to enable carp traces
+    my $cwd = (File::Spec->splitpath($ENV{SCRIPT_FILENAME} || $0))[1];
+    @dirs = File::Spec->splitdir($cwd);
+    
+    #go two dirs up
+    pop @dirs unless pop @dirs; # remove empty dir in case of trailing /
+    pop @dirs;
+    
+	push @INC, File::Spec->catdir(@dirs,'lib');
+	
+	package IMPL::Config;
+	
+	our $AppBase = File::Spec->catdir(@dirs);
+	our $ConfigBase = File::Spec->catdir(@dirs,'config');
+	
+	package IMPL::Web::Application::ControllerUnit;
+	
+	our @schemaInc;
+	
+	push @schemaInc, File::Spec->catdir(@dirs,'schema');
+	
+	package main;
+	
+	my $bootstrap = File::Spec->catfile($ConfigBase, 'bootstrap.pm');
+	if( -f $bootstrap ) {
+	    do $bootstrap;
+	    
+	    ($! ? die($@,$!) : die($@) )if $@;
+	    
+	}
+
+}
+
+1;
\ No newline at end of file