Thread datei einbinden (5 answers)
Opened by kale_1990 at 2006-12-24 15:15

bloonix
 2006-12-24 18:09
#72735 #72735
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
package Kale_1990::Database;

use strict;
use warnings;
use DBI;
use DBD::mysql;

sub connect {
  my $class = shift;
  my ($user,$pass,$db,$host) = @_;
  my $dbh = DBI->connect("DBI:mysql:$db:$host",$user,$pass) or die $DBI::errstr;
  return $dbh;
}


Code: (dl )
1
2
3
4
use Kale_1990::Database;

my $dbh = connect Kale_1990::Database;
my $sth = $dbh->prepare('...');


ungetestet!\n\n

<!--EDIT|opi|1166976576-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread datei einbinden