File: startup.pl

package info (click to toggle)
libembperl-perl 2.5.0-17
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 7,632 kB
  • sloc: ansic: 21,387; perl: 14,497; javascript: 4,280; cpp: 467; xml: 49; makefile: 35; sh: 24
file content (86 lines) | stat: -rw-r--r-- 2,020 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

BEGIN { 
    use lib qw{ . } ;
    use ExtUtils::testlib ;
    use Cwd ;

    $ENV{MOD_PERL} =~ m#/(\d+)\.(\d+)# ;
    $mp2 = 1 if ($1 == 2 || ($1 == 1 && $2 >= 99)) ;
    
    if ($mp2 && $ENV{PERL5LIB}) 
        {
        $ENV{PERL5LIB} =~ /^(.*)$/ ;
        eval 'use lib split (/:/, $1) ;' ;
        }
    my $dir = Cwd::fastcwd ;
    $dir =~ s#/#\\#g ;
    $dir =~ /^(.+)$/ ;
    $dir = $1 ; # untaint 
    $ENV{EMBPERL_SRC} =~ /^(.*?)$/;
    my $cwd       = $1 ; # untaint
    my $i = 0 ;
    foreach (@INC)
        {
        $INC[$i] = "$cwd/$_" if (/^\.?\/?blib/) ;
        $INC[$i] = "$cwd/$1" if (/^\Q$dir\E\\(blib\\.+)$/i) ;
        $INC[$i] =~ s#//#/#g ;
        $i++ ;
        }
   


    if (!$mp2)
        {
        require Apache ;
        require Apache::Registry ;
        }
    else
        {
	eval 'use Apache2' ;
#        require ModPerl::Registry ;
        }

    } ;


BEGIN 
    {
    $ENV{EMBPERL_SRC} =~ /^(.*?)$/;
    my $cwd       = $1 ;

    eval "use lib \"$cwd/eg/forms\"" ;

    if ($ENV{TEST_PRELOAD})
        {
        $Embperl::initparam{debug} = 0x7fffffff ;
        $Embperl::initparam{preloadfiles} = [
                { inputfile  => "$cwd/test/html/div.htm",  input_escmode => 7, debug => 0x7fffffff },
                { inputfile  => "$cwd/test/html/EmbperlObject/sub/eposubs.htm", input_escmode => 7, debug => 0x7fffffff }
                ] ;
        print "Preload initated\n" ;
        }

    }

# Bug#418067: apache2.2-mpm (at least) doesn't create a new process
# group with apache -X.  When exiting though, it SIGTERM's whatever
# the process group happens to be, wreaking havoc.  More importantly
# it causes 'make test' to exit with failure.  Hack around that here:
use POSIX ();
POSIX::setpgid(0,0);

use Embperl ;
use Embperl::Object ;

$ENV{EMBPERL_SRC} =~ /^(.*?)$/;
my $cwd       = $1 ;

require "$cwd/test/testapp.pl" ;

$cp = Embperl::Util::AddCompartment ('TEST') ;

$cp -> deny (':base_loop') ;
$testshare = "Shared Data" ;
$cp -> share ('$testshare') ;  

1 ;