9 |
use DBI; |
use DBI; |
10 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
11 |
use Carp qw/confess/; |
use Carp qw/confess/; |
12 |
|
use Jifty; |
13 |
|
|
14 |
our $debug = 0; |
our $debug = 0; |
15 |
|
|
36 |
sub dbh { |
sub dbh { |
37 |
my $self = shift; |
my $self = shift; |
38 |
|
|
39 |
my $instance = shift || $self->instance || confess "no instance"; |
my $instance = shift || ref($self) && $self->instance || confess "no instance"; |
40 |
|
|
41 |
return $instance_dbh->{$instance} if $instance_dbh->{$instance}; |
return $instance_dbh->{$instance} if $instance_dbh->{$instance}; |
42 |
|
|
52 |
|
|
53 |
Jifty->log->info("Connect to instance $instance with dsn $dsn"); |
Jifty->log->info("Connect to instance $instance with dsn $dsn"); |
54 |
|
|
55 |
my $dbh = DBI->connect( $dsn, $database->{user}, $database->{passwd} ) or die $DBI::errstr; |
my $dbh = DBI->connect( $dsn, $database->{user}, $database->{passwd} ) or die "$DBI::errstr\n"; |
56 |
|
|
57 |
$instance_dbh->{$instance} = $dbh; |
$instance_dbh->{$instance} = $dbh; |
58 |
|
|
236 |
} |
} |
237 |
|
|
238 |
my $depth = $kat->{depth}; |
my $depth = $kat->{depth}; |
239 |
|
if ( ! defined $pos[ $depth - 2 ] ) { |
240 |
|
warn "FIXING CATEGORY: ",dump( $kat ); |
241 |
|
$node->{class} = "error"; |
242 |
|
$depth--; |
243 |
|
} |
244 |
@pos = splice( @pos, 0, $depth ); |
@pos = splice( @pos, 0, $depth ); |
245 |
$pos[ $depth - 1 ]++; |
$pos[ $depth - 1 ]++; |
246 |
|
|