Les PerlSections, ou comment configurer Apache en Perl

Ça sert à WebSite.

Sources de doc

Des exemples

Un exemple de Lunar

<Perl>
#!perl

use DBI;

my $db_dbname = "nologweb";
my $db_username = "root";
my $db_password = "";

my $dsn = "DBI:mysql:$db_dbname:localhost";
my $dbh = DBI->connect($dsn, $db_username, $db_password)
    or die("Unable to connect to database: $DBI::errstr");

my $sth = $dbh->prepare(qq{
      SELECT login
        FROM accounts
}) or die("Unable to prepare statement: " . $dbh->errstr);
$sth->execute() or die ("Unable to execute query: " . $sth->errstr);
while (my @data = $sth->fetchrow_array()) {
    my $LOGIN = $data[0];
    my $PATH = "/var/www/w.no-log.org/" . substr($LOGIN, 0, 1) . "/" .
$LOGIN;
    push @{ $VirtualHost{'*'} },
        { 'ServerName'            => "$LOGIN.w.no-log.org"
        , 'ServerAdmin'           => 'root@globenet.org'
        , 'DocumentRoot'          => "$PATH/public_html"
        , 'php_admin_flag engine' => 'off'
        , 'suPHP_Engine'          => 'On'
        , 'suPHP_ConfigPath'      => "$PATH"
        };
}

$sth->finish;
$dbh->disconnect;

</Perl>