[Cpan-forum-commit] rev 163 - in trunk: . bin lib/CPAN lib/CPAN/Forum t/lib/CPAN/Forum www/cgi
svn at pti.co.il
svn at pti.co.il
Fri Aug 25 18:14:56 IDT 2006
Author: gabor
Date: 2006-08-25 18:14:46 +0300 (Fri, 25 Aug 2006)
New Revision: 163
Modified:
trunk/
trunk/bin/setup.pl
trunk/lib/CPAN/Forum.pm
trunk/lib/CPAN/Forum/DBI.pm
trunk/t/lib/CPAN/Forum/Test.pm
trunk/www/cgi/index.pl
Log:
simplify database connection
make sure the application works on the development machine
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:10983
+ 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:10991
Modified: trunk/bin/setup.pl
===================================================================
--- trunk/bin/setup.pl 2006-08-25 15:14:28 UTC (rev 162)
+++ trunk/bin/setup.pl 2006-08-25 15:14:46 UTC (rev 163)
@@ -37,7 +37,7 @@
my $dbfile = "$opts{dir}/forum.db";
unlink $dbfile if -e $dbfile;
mkdir $opts{dir} if not -e $opts{dir};
-CPAN::Forum::DBI->myinit($dbfile);
+CPAN::Forum::DBI->myinit("dbi:SQLite:$dbfile");
CPAN::Forum::DBI->init_db("schema/schema.sql", $dbfile);
chmod 0755, $dbfile;
Modified: trunk/lib/CPAN/Forum/DBI.pm
===================================================================
--- trunk/lib/CPAN/Forum/DBI.pm 2006-08-25 15:14:28 UTC (rev 162)
+++ trunk/lib/CPAN/Forum/DBI.pm 2006-08-25 15:14:46 UTC (rev 163)
@@ -8,13 +8,17 @@
use Class::DBI::Plugin::Pager;
use DBI;
+my $dbh;
sub myinit {
my $class = shift;
- my $dbfile = shift;
- __PACKAGE__->connection("dbi:SQLite:$dbfile", '', '',
+ my $db_connect = shift;
+ if (not $dbh) {
+ $dbh = __PACKAGE__->connection($db_connect, '', '',
{
});
+ }
+ return $dbh;
}
our @group_types = ("None", "Global", "Field", "Distribution", "Module");
Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm 2006-08-25 15:14:28 UTC (rev 162)
+++ trunk/lib/CPAN/Forum.pm 2006-08-25 15:14:46 UTC (rev 163)
@@ -251,6 +251,9 @@
Removed the use of CPAN::Forum::Build - need to see what was it doing and
replace its functionality with something better
+Create links http://www.cpanforum.com/rss/author/PAUSEID
+These links don't seem to contain any data http://www.cpanforum.com/rss/dist/OpenOffice-OODoc
+
Subject field:
- <= 80 chars
- Can contain any characters, we'll escape them when showing on the web site
@@ -401,8 +404,12 @@
sub cgiapp_init {
my $self = shift;
+
+ my $db_connect = $self->param("DB_CONNECT");
+ use CPAN::Forum::DBI;
+ CPAN::Forum::DBI->myinit($db_connect);
my $dbh = CPAN::Forum::DBI::db_Main();
-
+
my $log = $self->param("ROOT") . "/db/messages.log";
$STATUS_FILE = $self->param("ROOT") . "/db/status";
my $log_level = $self->_set_log_level();
Modified: trunk/t/lib/CPAN/Forum/Test.pm
===================================================================
--- trunk/t/lib/CPAN/Forum/Test.pm 2006-08-25 15:14:28 UTC (rev 162)
+++ trunk/t/lib/CPAN/Forum/Test.pm 2006-08-25 15:14:46 UTC (rev 163)
@@ -32,14 +32,14 @@
sub get_mech {
use Test::WWW::Mechanize::CGI;
my $w = Test::WWW::Mechanize::CGI->new;
+ mkdir "$ROOT/db";
$w->cgi(sub {
require CPAN::Forum;
- require CPAN::Forum::DBI;
- CPAN::Forum::DBI->myinit("$ROOT/db/forum.db");
my $webapp = CPAN::Forum->new(
TMPL_PATH => "templates",
PARAMS => {
- ROOT => $ROOT,
+ ROOT => $ROOT,
+ DB_CONNECT => "dbi:SQLite:$ROOT/db/forum.db"
},
);
$webapp->run();
Modified: trunk/www/cgi/index.pl
===================================================================
--- trunk/www/cgi/index.pl 2006-08-25 15:14:28 UTC (rev 162)
+++ trunk/www/cgi/index.pl 2006-08-25 15:14:46 UTC (rev 163)
@@ -1,28 +1,26 @@
-#!/opt/perl584/bin/perl
+#!/usr/bin/perl
use warnings;
use strict;
$| = 1;
-# the following line is updated during installation
-use constant ROOT => "/home/gabor/work/cpan-forum";
+use FindBin qw($Bin);
+my $ROOT;
+BEGIN {$ROOT = "$Bin/../..";}
+use lib ("$ROOT/lib");
-use lib (ROOT . "/lib");
-
use CPAN::Forum;
-use CPAN::Forum::DBI;
-CPAN::Forum::DBI->myinit(ROOT . "/db/forum.db");
-
binmode STDOUT, ":utf8";
binmode STDIN, ":utf8";
binmode STDERR, ":utf8";
my $app = CPAN::Forum->new(
- TMPL_PATH => ROOT . "/templates",
+ TMPL_PATH => "$ROOT/templates",
PARAMS => {
- ROOT => ROOT,
+ ROOT => $ROOT,
+ DB_CONNECT => "dbi:SQLite:$ROOT/db/forum.db"
},
);
$app->run();
More information about the Cpan-forum-commit
mailing list