Stem
view release on metacpan or search on metacpan
bin/run_stem view on Meta::CPAN
#!/usr/local/bin/perl -w
# File: bin/run_stem
# This file is part of Stem.
# Copyright (C) 1999, 2000, 2001 Stem Systems, Inc.
# Stem is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# Stem is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Stem; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# For a license to use the Stem under conditions other than those
# described here, to purchase support for this software, or to purchase a
# commercial warranty contract, please contact Stem Systems at:
# Stem Systems, Inc. 781-643-7504
# 79 Everett St. info@stemsystems.com
# Arlington, MA 02474
# USA
$Data::Dumper::Indent = 1 ;
$Data::Dumper::Purity = 1 ;
$Data::Dumper::Useqq = 1 ;
$| = 1 ;
#print "RUN STEM $0\n" ;
my @conf_args ;
# we set Stem's default environment before we load any Stem modules so
# they can use those values
use Stem::InstallConfig ;
BEGIN {
my $env_text ;
my $stem_lib_dir = $Stem::InstallConfig::Config{'conf_path'} ;
my $is_win32 = $^O =~ /Win32/i ;
# get the site env and home env files
my @env_files = "$stem_lib_dir/env" ;
unless ( $is_win32 ) {
push @env_files, ( $ENV{HOME} ||
$ENV{LOGDIR} ||
(getpwuid($>))[7] ) . '/.stem_env' ;
}
foreach my $env_file ( @env_files ) {
next unless -r $env_file ;
# shut up a dumb warning
use vars '*ARGVOUT' ;
$env_text .=
do { local( @ARGV, $/ ) = $env_file ; <> } ;
}
# set the starting %env from the files
%Stem::Vars::Env = $env_text =~ /^([^=]+)=(.+)$/mg if $env_text ;
# set the %Stem::Vars::Env from %ENV any %ENV name starting with STEM_
# is used. the STEM_ is deleted and the rest of the lower case name is
# used with the %ENV value
/^STEM_(\w+)/ and $Stem::Vars::Env{ lc $1 } = $ENV{ $_ } for keys %ENV ;
# set %Stem::Vars::Env from 'name=value' command line args
# all other args are assumed to be conf file names.
# we do this after we process %ENV so the command line args can override
# any shell environment values
while( @ARGV ) {
my $arg = shift ;
if ( $arg =~ /([^=]+)=(.*)/ ) {
$Stem::Vars::Env{ $1 } = $2 ;
next ;
}
push @conf_args, $arg ;
}
# set the default config search path. this will be changed by the install
# script.
$Stem::Vars::Env{ 'conf_path' } ||= 'conf:.' ;
# set the trace levels
# $Stem::Vars::Env{ 'MainTraceStatus' } ||= 1 ;
# $Stem::Vars::Env{ 'MainTraceError' } ||= 1 ;
# $Stem::Vars::Env{ 'ProcTraceStatus' } ||= 1 ;
# $Stem::Vars::Env{ 'ProcTraceError' } ||= 1 ;
# $Stem::Vars::Env{ 'PortalTraceStatus' } ||= 1 ;
# $Stem::Vars::Env{ 'PortalTraceError' } ||= 1 ;
# $Stem::Vars::Env{ 'SockMsgTraceStatus' } ||= 1 ;
# $Stem::Vars::Env{ 'SockMsgTraceError' } ||= 1 ;
# $Stem::Vars::Env{ 'ConfTraceStatus' } ||= 1 ;
# $Stem::Vars::Env{ 'ConfTraceError' } ||= 1 ;
# $Stem::Vars::Env{ 'LogTraceStatus' } ||= 1 ;
( run in 0.462 second using v1.01-cache-2.11-cpan-39bf76dae61 )