########################################################################
#
# $Id: Configs.pm.html,v 1.1 2002/10/12 22:09:53 gosha Exp $
#
# Copyright (C) Okunev Igor gosha@prv.mts-nn.ru 2001-2002
#
########################################################################
package WB::Configs;
use strict;
use vars qw( @ISA @EXPORT $VERSION %CONFIGS );
use Exporter;
($VERSION='$Revision: 1.1 $')=~s/^\S+\s+(\S+)\s+.*/$1/;
@ISA = qw( Exporter );
@EXPORT = qw( init_project );
%CONFIGS = (
'def' => 0,
# 0 => 'RealWeb',
0 => 'Local',
# 2 => 'BlackSquare'
);
#
# Инициализация динамических переменных проекта
#
sub init_project {
my $self = shift;
if ( defined $self and ( ref $self eq __PACKAGE__ or UNIVERSAL::isa( $self, __PACKAGE__ ) ) ) {
$self = shift;
}
local $_;
unless ( defined $self->r_param( 'prj' ) and
exists $CONFIGS{ $self->r_param( 'prj' ) } ) {
$self->r_param( 'prj' => $CONFIGS{ 'def' } );
}
$self->cfg( 'PROJECT_ID' => int $self->r_param( 'prj' ) );
eval 'require WB::Configs::'. $CONFIGS{ $self->r_param( 'prj' ) } ;
die $@ if $@;
no strict qw/refs/;
&{'WB::Configs::' . $CONFIGS{ $self->r_param( 'prj' ) } . '::configure'}( $self );
eval ' require WB::Templates::' . $self->cfg( 'TEMPLATE_MODULE' ) . ';
require WB::Sendmails::' . $self->cfg( 'SENDMAIL_MODULE' ) . ';';
die $@ if $@;
$self->cfg( 'SENDMAIL_TYPE' => ${'WB::Sendmails::' . $self->cfg( 'SENDMAIL_MODULE' ) . '::TYPE'} || 0 );
return 1;
}
1;