my $dbuser = BSE::Test::test_dbuser();
my $dbpass = BSE::Test::test_dbpass();
-$con =~ s/(^\$DSN = ')[^']*/$1 . BSE::Test::test_dsn()/me;
-$con =~ s/(^\$DBCLASS = ')[^']*/$1 . BSE::Test::test_dbclass()/me;
-$con =~ s/(^\$UN = ')[^']*/$1$dbuser/m;
-$con =~ s/(^\$PW = ')[^']*/$1$dbpass/m;
+#$con =~ s/(^\$DSN = ')[^']*/$1 . BSE::Test::test_dsn()/me;
+#$con =~ s/(^\$DBCLASS = ')[^']*/$1 . BSE::Test::test_dbclass()/me;
+#$con =~ s/(^\$UN = ')[^']*/$1$dbuser/m;
+#$con =~ s/(^\$PW = ')[^']*/$1$dbpass/m;
$con =~ s/(^\$BASEDIR = ')[^']+/$1 . BSE::Test::base_dir/me;
#$con =~ s/(^\$URLBASE = ["'])[^'"]+/$1 . BSE::Test::base_url/me;
#$con =~ s/(^\$SECURLBASE = ["'])[^'"]+/$1 . BSE::Test::test_securl/me;
print CON $con;
close CON;
+
# rebuild the config file
# first load values from the test.cfg file
my $conffile = BSE::Test::test_conffile();
}
$uploads = $conf{paths}{downloads};
-# fix bse.cfg
-open CFG, "< $instbase/cgi-bin/bse.cfg"
- or die "Cannot open $instbase/cgi-bin/bse.cfg: $!";
-my $section = "";
-my @cfg;
-while (<CFG>) {
- chomp;
- if (/^\[(.*)\]\s*$/) {
- my $newsect = lc $1;
- if ($conf{$section} && keys %{$conf{$section}}) {
- for my $key (sort keys %{$conf{$section}}) {
- push @cfg, "$key=$conf{$section}{$key}";
- }
- delete $conf{$section};
- }
- $section = $newsect;
- }
- elsif (/^\s*(\w+)\s*=\s*.*$/ && exists $conf{$section}{lc $1}) {
- my $key = lc $1;
- print "found $section.$key\n";
- $_ = "$key=$conf{$section}{$key}";
- delete $conf{$section}{$key};
- }
- push @cfg, $_;
-}
-if ($conf{$section} && keys %{$conf{$section}}) {
- for my $key (sort keys %{$conf{$section}}) {
- push @cfg, "$key=$conf{$section}{$key}";
+# create installation config
+
+$conf{db}{class} = BSE::Test::test_dbclass();
+$conf{db}{dsn} = BSE::Test::test_dsn();
+$conf{db}{user} = $dbuser;
+$conf{db}{password} = $dbpass;
+
+open CFG, "> $instbase/cgi-bin/bse-install.cfg"
+ or die "Cannot create $instbase/cgi-bin/bse-install.cfg: $!";
+
+print CFG "; DO NOT EDIT - created during installation\n";
+for my $section_name (keys %conf) {
+ print CFG "[$section_name]\n";
+ my $section = $conf{$section_name};
+ for my $key (keys %$section) {
+ print CFG "$key=$section->{$key}\n";
}
- delete $conf{$section};
+ print CFG "\n";
}
-for my $sect (keys %conf) {
- if ($conf{$sect} && keys %{$conf{$sect}}) {
- push @cfg, "[$sect]";
- for my $key (sort keys %{$conf{$sect}}) {
- push @cfg, "$key=$conf{$sect}{$key}";
- }
- push @cfg, "";
- }
-}
-close CFG;
-open CFG, "> $instbase/cgi-bin/bse.cfg"
- or die "Cannot create $instbase/cgi-bin/bse.cfg: $!";
-for my $line (@cfg) {
- print CFG $line, "\n";
-}
close CFG;
-d $uploads
use strict;
use FindBin;
use lib "$FindBin::Bin/../modules";
-use Constants qw($UN $PW $DSN $SHOP_FROM $DATA_EMAIL);
+use BSE::Request;
+use Constants qw($SHOP_FROM $DATA_EMAIL);
use BSE::Mail;
-use BSE::Cfg;
use DevHelp::HTML;
-my $cfg = BSE::Cfg->new;
-
-my $email = $cfg->entryIfVar('datadump', 'to') || $DATA_EMAIL;
-my $from = $cfg->entryIfVar('datadump', 'from') || $SHOP_FROM;
-my $urlbase = $cfg->entryVar('site', 'url');
-my $opts = '-t';
-my $dumper = $cfg->entryIfVar('datadump', 'mysqldump') || 'mysqldump';
-$|=1;
-print "Content-Type: text/html\n\n";
-
-unless ($email) {
- print "Configuration Error: You need to set the <b>to</b> key in the [datadump] section of the config file, or \$DATA_EMAIL in Constants.pm";
- exit;
-}
-unless ($from) {
- print "Configuration Error: You need to set the <b>from</b> key in the [datadump] section of the config file, or \$SHOP_FROM in Constants.pm";
- exit;
-}
-my $user = $UN;
-my $pass = $PW;
-my $data;
-my $host;
-my $port;
-if ($DSN =~ /^dbi:mysql:(\w+)$/i) {
- $data = $1;
+my $req = BSE::Request->new;
+
+{
+ if (!$req->check_admin_logon) {
+ my $url = $req->url("logon", { m => "You must logon to dump the database" });
+ $req->output_result($req->get_refresh($url));
+ }
+ elsif (!$req->user_can("bse_datadump")) {
+ my $url = $req->url("menu", { m => "You don't have access to dump the database" });
+ $req->output_result($req->get_refresh($url));
+ }
+ else {
+ do_dump($req);
+ }
}
-elsif ($DSN =~ /^dbi:mysql:(.*)$/i) {
- my @entries = split /;/, $1;
- for my $entry (@entries) {
- if ($entry =~ /^hostname=(.+)$/i) {
- $host = $1;
- }
- elsif ($entry =~ /^database=(.+)$/i) {
- $data = $1;
+
+sub do_dump {
+ my ($req) = @_;
+
+ my $cfg = $req->cfg;
+
+ my $email = $cfg->entryIfVar('datadump', 'to') || $DATA_EMAIL;
+ my $from = $cfg->entryIfVar('datadump', 'from') || $SHOP_FROM;
+ my $urlbase = $cfg->entryVar('site', 'url');
+ my $opts = '-t';
+ my $dumper = $cfg->entryIfVar('datadump', 'mysqldump') || 'mysqldump';
+ $|=1;
+ print "Content-Type: text/html\n\n";
+
+ unless ($email) {
+ print "Configuration Error: You need to set the <b>to</b> key in the [datadump] section of the config file, or \$DATA_EMAIL in Constants.pm";
+ return;
+ }
+ unless ($from) {
+ print "Configuration Error: You need to set the <b>from</b> key in the [datadump] section of the config file, or \$SHOP_FROM in Constants.pm";
+ return;
+ }
+
+ my $user = BSE::DB->dbuser($cfg);
+ my $pass = BSE::DB->dbpassword($cfg);
+ my $data;
+ my $host;
+ my $port;
+ my $dsn = BSE::DB->dsn($cfg);
+ if ($dsn =~ /^dbi:mysql:(\w+)$/i) {
+ $data = $1;
+ }
+ elsif ($dsn =~ /^dbi:mysql:(.*)$/i) {
+ my @entries = split /;/, $1;
+ for my $entry (@entries) {
+ if ($entry =~ /^hostname=(.+)$/i) {
+ $host = $1;
+ }
+ elsif ($entry =~ /^database=(.+)$/i) {
+ $data = $1;
+ }
+ elsif ($entry =~ /^port=(.+)$/i) {
+ $port = $1;
+ }
}
- elsif ($entry =~ /^port=(.+)$/i) {
- $port = $1;
+ unless ($data) {
+ print "Sorry, could not find database in ",escape_html($dsn),"<br>\n";
+ return;
}
}
- unless ($data) {
- print "Sorry, could not find database in ",escape_html($DSN),"<br>\n";
+ else {
+ print "Sorry, this doesn't appear to be a mysql database<br>\n";
exit;
}
-}
-else {
- print "Sorry, this doesn't appear to be a mysql database<br>\n";
- exit;
-}
-
-for ($user, $pass, $data) {
- s/(["\\`\$])/\\$1/;
-}
-my $cmd = qq!$dumper !;
-$cmd .= qq!-P$port ! if $port;
-$cmd .= qq!-h$host ! if $host;
-$cmd .= qq!"-u$user" "-p$pass" "$data"!;
-open DUMP, "$cmd 2>&1 |"
- or do { print "Cannot open mysqldump: $!\n"; exit };
-
-my $boundary = "============_".time."_==========";
-my $headers = <<EOS;
+
+ for ($user, $pass, $data) {
+ s/(["\\`\$])/\\$1/;
+ }
+ my $cmd = qq!$dumper !;
+ $cmd .= qq!-P$port ! if $port;
+ $cmd .= qq!-h$host ! if $host;
+ $cmd .= qq!"-u$user" "-p$pass" "$data"!;
+ open DUMP, "$cmd 2>&1 |"
+ or do { print "Cannot open mysqldump: $!\n"; exit };
+
+ my $boundary = "============_".time."_==========";
+ my $headers = <<EOS;
Content-Type: multipart/mixed;
boundary="$boundary"
MIME-Version: 1.0
EOS
-
-my $body = <<EOS;
+
+ my $body = <<EOS;
This is a multipart message in MIME format
Content-Disposition: attachment; filename=bsedump.txt
EOS
-while (<DUMP>) {
- $body .= $_;
-}
+ while (<DUMP>) {
+ $body .= $_;
+ }
-$body .= <<EOS;
+ $body .= <<EOS;
--$boundary--
EOS
-my $mailer = BSE::Mail->new(cfg=>$cfg);
-$mailer->send(to=>$email,
- from=>$from,
- headers=>$headers,
- body=>$body,
- subject=>$cfg->entry('datadump') || "Data dump")
- or print "Error sending email: ",escape_html($mailer->errstr),"<br>\n";
-unless (close DUMP) {
- print "There may have been a problem retrieving the dump, please check the error log<br>";
+ my $mailer = BSE::Mail->new(cfg=>$cfg);
+ $mailer->send(to=>$email,
+ from=>$from,
+ headers=>$headers,
+ body=>$body,
+ subject=>$cfg->entry('datadump') || "Data dump")
+ or print "Error sending email: ",escape_html($mailer->errstr),"<br>\n";
+ unless (close DUMP) {
+ print "There may have been a problem retrieving the dump, please check the error log<br>";
+ }
+ print "Database dump for $urlbase sent to $email\n";
}
-print "Database dump for $urlbase sent to $email\n";
__END__
}
my $cfg = BSE::Cfg->new;
+BSE::DB->init($cfg);
my $urlbase = $cfg->entryVar('site', 'url');
my $articles = 'Articles';
[includes]
00bsecfg_d=bsecfg_d/
50local=bse-local.cfg
+install=bse-install.cfg
[mail resources]
stylesheet=email/email.css,text/css,1
use strict;
use vars qw(@ISA @EXPORT_OK);
use BSE::Util::SQL qw(sql_datetime now_sqldatetime);
+use BSE::DB;
use BSE::Cfg;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(bse_cfg bse_make_product bse_make_catalog bse_encoding bse_add_image bse_add_step_child bse_add_owned_file bse_delete_owned_file bse_replace_owned_file bse_make_article bse_add_step_parent);
+@EXPORT_OK = qw(bse_init bse_cfg bse_make_product bse_make_catalog bse_encoding bse_add_image bse_add_step_child bse_add_owned_file bse_delete_owned_file bse_replace_owned_file bse_make_article bse_add_step_parent);
use Carp qw(confess croak);
use Fcntl qw(:seek);
+use Cwd;
my %acticle_defaults =
(
}
}
+my $cfg;
+
sub bse_cfg {
- my $cfg = BSE::Cfg->new;
+ my $path = shift || ".";
+ $cfg ||= BSE::Cfg->new(path => $path);
$cfg->entry('site', 'url')
or confess "Could not load configuration";
return $cfg;
}
+sub bse_init {
+ my ($bse_cgi) = @_;
+
+ defined $bse_cgi
+ or confess "Missing bse_cgi parameter";
+
+ unless ($cfg) {
+ bse_cfg($bse_cgi);
+ }
+
+ BSE::DB->init($cfg);
+}
+
sub bse_make_product {
my (%opts) = @_;
use vars qw($VERSION);
$VERSION = '1.00';
-use Constants qw/$DBCLASS/;
+my $single;
-my $file = $DBCLASS;
-$file =~ s!::!/!g;
-require "$file.pm";
+my $constants_loaded = eval {
+ require Constants;
+ 1;
+};
+
+sub dsn {
+ my ($class, $cfg) = @_;
+
+ $cfg or confess "Missing cfg option";
+
+ return $cfg->entry("db", "dsn", $Constants::DSN);
+}
+
+sub dbuser {
+ my ($class, $cfg) = @_;
+
+ $cfg or confess "Missing cfg option";
+
+ return $cfg->entry("db", "user", $Constants::UN);
+}
+
+sub dbpassword {
+ my ($class, $cfg) = @_;
+
+ $cfg or confess "Missing cfg option";
+
+ return $cfg->entry("db", "password", $Constants::PW);
+}
+
+sub dbopts {
+ my ($class, $cfg) = @_;
+
+ $cfg or confess "Missing cfg option";
+
+ my $def_opts = $Constants::DBOPTS || {};
+
+ my $opts = $cfg->entry("db", "dbopts", $def_opts);
+ unless (ref $opts) {
+ my $work_opts = eval $opts;
+ $@
+ and confess "Error evaluation db options: $@";
+
+ $opts = $work_opts;
+ }
+
+ return $opts;
+}
+
+sub init {
+ my ($class, $cfg) = @_;
+
+ $single and return;
+
+ my $dbclass = $cfg->entry("db", "class", "BSE::DB::Mysql");
+
+ my $file = $dbclass;
+ $file =~ s!::!/!g;
+ require "$file.pm";
+
+ $single = $dbclass->_single($cfg);
+}
sub single {
- $DBCLASS->_single();
+ $single
+ or confess "BSE::DB->init(\$cfg) needs to be called first";
+ $single;
}
sub startup {
- $DBCLASS->_startup();
+ $single->_startup();
}
sub query {
}
sub _connect {
- my $dbh = DBI->connect( $DSN, $UN, $PW, $DBOPTS)
+ my ($self) = @_;
+
+ my $cfg = $self->{cfg};
+ my $dsn = $self->dsn($cfg);
+ my $un = $self->dbuser($cfg);
+ my $pass = $self->dbpassword($cfg);
+ my $dbopts = $self->dbopts($cfg);
+ my $dbh = DBI->connect( $dsn, $un, $pass, $dbopts)
or die "Cannot connect to database: $DBI::errstr";
-
+
# this might fail, but I don't care
$dbh->do("set session sql_mode='ansi_quotes'");
sub _single
{
- my $class = shift;
+ my ($class, $cfg) = @_;
- warn "Incorrect number of parameters passed to DatabaseHandle::single\n" unless @_ == 0;
+ warn "Incorrect number of parameters passed to BSE::DB::Mysql::single\n" unless @_ == 2;
unless ( defined $self ) {
- my $dbh = $class->_connect;
-
- $self = bless { dbh => $dbh, birth => time() }, $class;
+ $self = bless
+ {
+ dbh => undef,
+ birth => time(),
+ cfg => $cfg,
+ }, $class;
+
+ $self->{dbh} = $self->_connect;
}
$self;
}
sub new {
my ($class, %opts) = @_;
+ $opts{cfg} ||= BSE::Cfg->new;
+
+ BSE::DB->init($opts{cfg});
BSE::DB->startup();
- $opts{cfg} ||= BSE::Cfg->new;
$opts{cgi} ||= $class->_make_cgi;
$opts{fastcgi} ||= 0;
$_[0]->{cfg}->entry('basic', 'access_control', 0);
}
+sub get_refresh {
+ my ($req, $url) = @_;
+
+ require BSE::Template;
+ BSE::Template->get_refresh($url, $req->cfg);
+}
+
sub output_result {
my ($req, $result) = @_;
my %methods_created;
-my $dh = BSE::DB->single;
+my $dh;
sub new {
my ($class, @values) = @_;
@$self{@columns} = @values;
+ $dh ||= BSE::DB->single;
unless (defined $self->{$primary[0]}) {
my $bases = $class->bases;
if (keys %$bases) {
my $self = shift;
my %saved;
my $bases = $self->bases;
+ $dh ||= BSE::DB->single;
if (keys %$bases) {
my @bases = $self->_get_bases;
my $base_base = $bases[0];
sub remove {
my $self = shift;
+ $dh ||= BSE::DB->single;
my $bases = $self->bases;
my @primary = @$self{$self->primary};
if (keys %$bases) {
use BSE::DB;
-my $dh = BSE::DB->single;
-
my %query_cache;
my $cache_queries;
+my $dh;
+
# no caching is performed if this is zero
my $cache_timeout = 2; # seconds
&& defined $cache{$class}{time}
&& $cache{$class}{time}+$cache_timeout >= time;
+ $dh ||= BSE::DB->single;
my $sth = $dh->stmt($class)
or confess "No $class member in DatabaseHandle";
$sth->execute
}
}
+ $dh ||= BSE::DB->single;
my $result;
if (ref($self)) {
$result = $self->{coll}{join "", @values};
$vals{$col} = $val;
}
+ $dh ||= BSE::DB->single;
my @results;
if (ref($self) && UNIVERSAL::isa($self, __PACKAGE__)) {
# this is an object with the rows already loaded
" from " . $self->rowClass->table .
" where " . join(" and ", @conds);
+ $dh ||= BSE::DB->single;
my $sth = $dh->{dbh}->prepare($sql)
or confess "Cannot prepare generated $sql: ", $dh->{dbh}->errstr;
" from " . $self->rowClass->table .
" where " . join(" and ", @conds);
+ $dh ||= BSE::DB->single;
my $sth = $dh->{dbh}->prepare($sql)
or confess "Cannot prepare generated $sql: ", $dh->{dbh}->errstr;
my $rowClass = $self->rowClass;
my $sqlname = $class . "." . $name;
+ $dh ||= BSE::DB->single;
my $sth = $dh->stmt($sqlname)
or confess "No $sqlname in database object";
$sth->execute(@args)
my $class = ref $self ? ref $self : $self;
my $sqlname = $class . "." . $name;
+ $dh ||= BSE::DB->single;
my $sth = $dh->stmt($sqlname)
or confess "No $sqlname in database object";
$sth->execute(@args)
sub query {
my ($self, $columns, $query, $opts) = @_;
+ $dh ||= BSE::DB->single;
$dh->generate_query($self->rowClass, $columns, $query, $opts);
}
}
sub generate_shop {
- my ($articles) = @_;
+ my ($articles, $cfg) = @_;
my @pages =
(
'cart', 'checkoutnew', 'checkoutfinal', 'checkoutcard', 'checkoutconfirm',
'checkoutpay',
);
require 'Generate/Article.pm';
- my $cfg = BSE::Cfg->new;
my $shop_base = $articles->getByPkey($SHOPID);
my $shop = { map { $_ => $shop_base->{$_} } $shop_base->columns };
$shop->{link} =~ /^\w+:/
generate_search($articles, $cfg);
$callback->("Generating shop base pages") if $callback;
- generate_shop($articles);
+ generate_shop($articles, $cfg);
$callback->("Generating extra pages") if $callback;
generate_extras($articles, $cfg, $callback);
generate_search($articles, $cfg);
$progress->("Generating shop base pages") if $progress ;
- generate_shop($articles);
+ generate_shop($articles, $cfg);
$progress->("Generating extra pages") if $progress;
generate_extras($articles, $cfg, $progress);
use warnings;
use FindBin;
use lib "$FindBin::Bin/../cgi-bin/modules";
+use BSE::API qw(bse_init bse_cfg);
use BSE::Cfg;
use BSE::TB::BackgroundTasks;
use Getopt::Long;
{
- chdir "$FindBin::Bin/../cgi-bin"
- or warn "Could not change to cgi-bin directory: $!\n";
-
- my $cfg = BSE::Cfg->new;
+ bse_init("../cgi-bin");
+ my $cfg = bse_cfg();
my $cmd = shift
or usage();
use strict;
use FindBin;
use lib "$FindBin::Bin/../cgi-bin/modules";
-use BSE::Cfg;
use BSE::StorageMgr::Images;
use BSE::StorageMgr::Files;
use BSE::StorageMgr::Thumbs;
use Getopt::Long;
+use BSE::API qw(bse_init bse_cfg);
my $verbose;
my $noaction;
GetOptions("v", \$verbose,
'n', \$noaction);
-chdir "$FindBin::Bin/../cgi-bin"
- or warn "Could not change to cgi-bin directory: $!\n";
+bse_init("../cgi-bin");
-my $cfg = BSE::Cfg->new;
+my $cfg = bse_cfg();
my $images = BSE::StorageMgr::Images->new(cfg => $cfg);
my $files = BSE::StorageMgr::Files->new(cfg => $cfg);
use FindBin;
use lib "$FindBin::Bin/../cgi-bin/modules";
use BSE::Cfg;
-use BSE::API qw(bse_cfg bse_make_product bse_encoding);
+use BSE::API qw(bse_init bse_cfg bse_make_product bse_encoding);
use BSE::Importer;
use Carp qw(confess);
-chdir "$FindBin::Bin/../cgi-bin"
- or warn "Could not change to cgi-bin directory: $!\n";
+bse_init("../cgi-bin");
my $verbose;
my $delete;
use FindBin;
use lib "$FindBin::Bin/../cgi-bin/modules";
use Util qw/generate_all generate_article/;
-use BSE::Cfg;
+use BSE::API qw(bse_init bse_cfg);
use Articles;
-chdir "$FindBin::Bin/../cgi-bin"
- or warn "Could not change to cgi-bin directory: $!\n";
+bse_init("../cgi-bin");
+
Getopt::Long::Configure('bundling');
my $verbose;
my $article;
GetOptions("v", \$verbose);
$verbose = defined $verbose;
-my $cfg = BSE::Cfg->new;
+my $cfg = bse_cfg();
my $articles = 'Articles';
use DBI;
use Article;
use Constants qw($DSN $UN $PW $CGI_URI $SHOP_URI $ROOT_URI);
-use BSE::Cfg;
+use BSE::API qw(bse_init bse_cfg);
use BSE::Util::SQL qw(now_sqldate now_sqldatetime);
-chdir "../cgi-bin"
- or warn "Could not change to cgi-bin directory - may not be able to get config file";
-my $cfg = BSE::Cfg->new;
+bse_init("../cgi-bin");
+my $cfg = bse_cfg();
my $securlbase = $cfg->entryVar('site', 'secureurl');
my $nowDate = now_sqldate();
my $nowDatetime = now_sqldatetime();
},
);
-my $dbh = DBI->connect($DSN, $UN, $PW)
+my $dbh = BSE::DB->single->dbh
or die "Cannot connect to database: ",DBI->errstr;
my @columns = Article->columns;
$dbh->do('delete from article')
use DevHelp::LoaderData;
use DBI;
use Constants;
+use BSE::API qw(bse_cfg bse_init);
+use BSE::DB;
+use Cwd;
+
+bse_init("../cgi-bin");
+
+my $cfg = bse_cfg;
my $datadir = shift
or die "Usage: $0 directoryname\n";
-my $dsn = $Constants::DSN;
-my $dbuser = $Constants::UN;
-my $dbpass = $Constants::PW;
-
# this is pretty rough, but good enough for now
-my $dbh = DBI->connect($dsn, $dbuser, $dbpass)
+my $dbh = BSE::DB::single->dbh
or die "Cannot connect to database: ",DBI->errstr;
+my $dbuser = BSE::DB->dbuser($cfg);
+
my %tables;
opendir DATADIR, $datadir or die "Cannot open '$datadir' directory: $!";
while (my $inname = readdir DATADIR) {
use Getopt::Long;
use FindBin;
use lib "$FindBin::Bin/../cgi-bin/modules";
-use BSE::Cfg;
+use BSE::API qw(bse_init bse_cfg);
use BSE::TB::Orders;
use Products;
-chdir "$FindBin::Bin/../cgi-bin"
- or warn "Could not change to cgi-bin directory: $!\n";
+bse_init("../cgi-bin");
my @orders = BSE::TB::Orders->all;
my %products;
use DBI;
use BSE::DB;
use Getopt::Long;
+use BSE::API qw(bse_init);
+use Cwd;
+
+bse_init("../cgi-bin");
my $verbose;
my $pretend;
my $entered = <STDIN>;
chomp $entered;
if ($entered ne $conf) {
- print "Either you didn't backup your data of you didn't read the message.\n";
+ print "Either you didn't backup your data or you didn't read the message.\n";
exit;
}
}
my $db = BSE::DB->single;
UNIVERSAL::isa($db, 'BSE::DB::Mysql')
- or die "Sorry, this only works for Mysql databases\n";
+ or die "Sorry, this only works for Mysql databases ($db)\n";
open STRUCT, "< $input"
or die "Cannot open structure file $input: $!\n";
or plan skip_all => "Cannot load BSE::Cfg";
}
-plan tests => 10;
+plan tests => 9;
-ok(chdir "t/cfg", "chdir to cfg dir");
-my $cfg = eval { BSE::Cfg->new };
+#ok(chdir "t/cfg", "chdir to cfg dir");
+my $cfg = eval { BSE::Cfg->new(path => "t/cfg") };
ok($cfg, "made a config");
is($cfg->entry("alpha", "beta"), "one", "check simple lookup");
is($cfg->entryVar("var", "varb"), "ab", "simple variable lookup");