Apache-SessionX

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    print "You can now specify the configuration parameters for every storage.\n" ;
    print "Apache::SessionX uses this for testing your system and stores it for later\n" ;
    print "use in your application. You can override these default parameters anytime\n" ;
    print "at runtime. You can change them by rerunning Makefile.PL.\n" ;
    print "\nIf you don't plan to use different storages for session, \nonly say Yes to the one storage you want to use.\n" ;

    foreach $store (@avail)
        {
        print "\n" ;
        $data = $Store{$store} ;
        $info = $data -> {param}{Info} ;
        if (GetYesNo("Would you like to configure $info ($store)", $param{$store}?1:0))
            {
            push @conf, $store ;
            $param{$store} = { %{$data->{param}} } if (!keys %{$param{$store}}) ;
            while (($param, $value) = each (%{$data->{param}}))
                {
                if ($value eq '?')
                    {
                    $value = GetString ($param, $param{$store}{$param} eq '?'?'':$param{$store}{$param}) ;
                    $param{$store}{$param} = $value ;
                    }
                }
            $param{$store}{'Store'}     ||= $store ;
            $param{$store}{'Serialize'} ||= 'Storeable' ;
            $param{$store}{'Lock'}      ||= 'Semaphore' ;
            $param{$store}{'Generate'}  ||= 'MD5' ;
            }
        }

    print "\n" ;
    $i = 1 ;
    foreach $store (@conf)
        {
        $data = $Store{$store} ;
        $info = $data -> {param}{Info} ;
        print " $i: $info ($store)\n" ;
        $def = $i if ($Apache::SessionX::Config::default eq $store) ;
        $i++ ;
        }

    $i--  ;
    if ($i == 1)
        {
        $default = 0 ;
        }
    else
        {
        $default = GetString ("Which of the above should be your default store (1-$i)", $def || '') ;
        $default-- ;
        }
    }

print "Using $conf[$default] as default\n" ;

open FH, ">SessionX/Config.pm" or die "Cannot open SessionX/Config.pm for writing ($!)" ;
print FH qq{
#
# Apache::SessionX configuration
#
# Autogenerated by Makefile.PL, do not edit!
#

package Apache::SessionX::Config ;

\$default = '$conf[$default]' ;

\@confs   = ('} ;

print FH join ("','", @conf) ;

print FH qq{') ; 
\%param   =
    (
} ;

foreach $store (@conf)
    {
    $p = $param{$store} ;
    print FH "    '$store' => \n" ;
    print FH "        {\n" ;
    while (($param, $value) = each (%$p))
        {
        print FH "         '$param' => '$value',\n" ;
        }
    print FH "        },\n" ;
    }

print FH qq{
    ) ;

\$defaultparam = \$param{'$conf[$default]'} ;

1 ;

} ;

close FH ;

# --------------------------------------------------------------------------- 

WriteMakefile
    (
    'NAME'	=> 'Apache::SessionX',
    'VERSION_FROM' => 'SessionX.pm', # finds $VERSION
    'PREREQ_PM'    => { 'Apache::Session' => 1.53 },
    'ABSTRACT'     => 'Web Session Management - based on Apache::Session',
    'AUTHOR'       => 'Gerald Richter <richter@dev.ecos.de>',
    );



( run in 0.535 second using v1.01-cache-2.11-cpan-39bf76dae61 )