2
###################################################################################
4
# Embperl - Copyright (c) 1997-2004 Gerald Richter / ecos gmbh www.ecos.de
6
# You may distribute under the terms of either the GNU General Public
7
# License or the Artistic License, as specified in the Perl README file.
9
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
10
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13
# $Id: Util.pm,v 1.4 2004/01/23 06:50:56 richter Exp $
15
###################################################################################
18
package Embperl::Util ;
21
use vars qw{@AliasScalar @AliasHash @AliasArray %NameSpace} ;
23
#######################################################################################
25
sub AddCompartment ($)
31
return $cp if (defined ($cp = $NameSpace{$sName})) ;
33
#eval 'require Safe' ;
34
#die "require Safe failed: $@" if ($@);
37
$cp = new Safe ($sName) ;
39
$NameSpace{$sName} = $cp ;
44
#######################################################################################
49
$Embperl::req -> app -> mail_form_to (@_) ;
52
#######################################################################################
55
@AliasScalar = qw{row col cnt tabmode escmode req_rec maxrow maxcol req_rec
56
dbgAll dbgAllCmds dbgCmd dbgDefEval dbgEarlyHttpHeader
57
dbgEnv dbgEval dbgFlushLog dbgFlushOutput dbgForm
58
dbgFunc dbgHeadersIn dbgImport dbgInput dbgLogLink
59
dbgMem dbgProfile dbgShowCleanup dbgSource dbgStd
60
dbgSession dbgTab dbgWatchScalar dbgParse dbgObjectSearch
61
optDisableChdir optDisableEmbperlErrorPage optReturnError optDisableFormData
62
optDisableHtmlScan optDisableInputScan optDisableMetaScan optDisableTableScan
63
optDisableSelectScan optDisableVarCleanup optEarlyHttpHeader optOpcodeMask
64
optRawInput optSafeNamespace optSendHttpHeader optAllFormData
65
optRedirectStdout optUndefToEmptyValue optNoHiddenEmptyValue optAllowZeroFilesize
66
optKeepSrcInMemory optKeepSpaces optOpenLogEarly optNoUncloseWarn
69
@AliasHash = qw{fdat udat mdat sdat idat http_headers_out fsplitdat} ;
70
@AliasArray = qw{ffld param} ;
73
#######################################################################################
79
my $package = caller ;
85
if (!defined(${"$package\:\:row"}))
86
{ # create new aliases for Embperl magic vars
88
foreach (@AliasScalar)
90
*{"$package\:\:$_"} = \${"Embperl\:\:$_"} ;
91
$dummy = ${"$package\:\:$_"} ; # necessary to make sure variable exists!
93
*{"$package\:\:epreq"} = \$Embperl::req ;
94
*{"$package\:\:epapp"} = \$Embperl::app ;
98
*{"$package\:\:$_"} = \%{"Embperl\:\:$_"} ;
100
foreach (@AliasArray)
102
*{"$package\:\:$_"} = \@{"Embperl\:\:$_"} ;
107
$sess = $Embperl::req -> app -> udat ;
108
*{"$package\:\:udat"} = $sess if ($sess) ;
109
$sess = $Embperl::req -> app -> mdat ;
110
*{"$package\:\:mdat"} = $sess if ($sess) ;
111
$sess = $Embperl::req -> app -> sdat ;
112
*{"$package\:\:sdat"} = $sess if ($sess) ;
114
*{"$package\:\:exit"} = \&Embperl::exit ;
115
*{"$package\:\:MailFormTo"} = \&Embperl::Util::MailFormTo ;
116
*{"$package\:\:Execute"} = \&Embperl::Req::ExecuteComponent ;
118
tie *{"$package\:\:LOG"}, 'Embperl::Log' ;
119
tie *{"$package\:\:OUT"}, 'Embperl::Out' ;
121
my $addcleanup = \%{"$package\:\:CLEANUP"} ;
122
$addcleanup -> {'CLEANUP'} = 0 ;
123
$addcleanup -> {'EXPIRES'} = 0 ;
124
$addcleanup -> {'CACHE_KEY'} = 0 ;
125
$addcleanup -> {'OUT'} = 0 ;
126
$addcleanup -> {'LOG'} = 0 ;
134
#######################################################################################