#!/usr/bin/perl -w # # modules/db.pm # # Developed by Lubomir Host 'rajo' # Copyright (c) 2004 Platon SDG, http://platon.sk/ # Licensed under terms of GNU General Public License. # All rights reserved. # # Changelog: # 08/02/2004 - created # # $Platon: scripts/perl/finance-manager/modules/db.pm,v 1.1 2004/02/11 10:52:53 rajo Exp $ package db; use strict; use Carp; use DBI qw(:sql_types); use vars qw($VERSION @ISA @EXPORT $AUTOLOAD); @ISA = qw(Exporter DBI ); @EXPORT = qw( ); $VERSION = '0.1'; sub new { # {{{ my $this = shift; my ($globals) = @_; my $class = ref($this) || $this; my $self = {}; # # Connect to DB # bless $self, $class; $self = DBI->connect( "dbi:" . $globals->data_source() . ":database=" . $globals->database() . ";host=" . $globals->db_host(), $globals->db_user(), $globals->db_password()) or die "Can't connect to" . $globals->db_host() . ": $DBI::errstr"; return $self; } # }}} 1; __END__ =head1 NAME db - <<>> =head1 SYNOPSIS use db; my $xxx = new db; =head1 DESCRIPTION The db module allows you ... <<>> =head2 EXPORT <>> =head1 SEE ALSO =head1 AUTHORS Lubomir Host 'rajo', =cut # vim: ts=4 # vim600: fdm=marker fdl=0 fdc=3