Subversion Repositories VORC

Rev

Rev 47 | Rev 63 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 47 Rev 50
Line 2... Line 2...
2
  use strict;
2
  use strict;
3
  use DBI;
3
  use DBI;
4
  my $host_name = "192.168.1.5";
4
  my $host_name = "192.168.1.5";
5
  my $db_name = "rollerco_vorc";
5
  my $db_name = "rollerco_vorc";
6
  my $dsn = "DBI:mysql:host=$host_name;database=$db_name";
6
  my $dsn = "DBI:mysql:host=$host_name;database=$db_name";
-
 
7
  $ENV{HOME} = "/tmp" unless $ENV{HOME};
Line 7... Line 8...
7
  
8
  
8
  # Connect to MySQL server, using hardwired name and password
9
  # Connect to MySQL server, using hardwired name and password
-
 
10
  sub connect  {
-
 
11
    return connect_with_option_file() unless !(-f $ENV{HOME}.'/.my.cnf');
-
 
12
    
9
  sub connect  {
13
    warn "using hardcoded password (not $ENV{HOME}/.my.cnf)...";
10
 	  return (DBI->connect ($dsn, "root", "********",
14
 	  return (DBI->connect ($dsn, "root", "********",
11
	  {PrintError => 0, RaiseError => 1}));
15
	  {PrintError => 0, RaiseError => 1}));
Line 12... Line 16...
12
  }
16
  }
Line 18... Line 22...
18
	  $dsn .= ";mysql_read_default_file=$ENV{HOME}/.my.cnf";
22
	  $dsn .= ";mysql_read_default_file=$ENV{HOME}/.my.cnf";
19
	  return (DBI->connect ($dsn, undef, undef,
23
	  return (DBI->connect ($dsn, undef, undef,
20
	  {PrintError => 0, RaiseError => 1}));
24
	  {PrintError => 0, RaiseError => 1}));
21
  }
25
  }
Line -... Line 26...
-
 
26
  
22
  
27
  # Quash any leading or trailing whitespace
23
  sub trim {
28
  sub trim {
Line 24... Line 29...
24
    my $str = shift;
29
    my $str = shift;
25
 
30
 
26
  	return "" if !defined $str;
31
  	return "" if !defined $str;
27
  	$str =~ s/^\s+//;
32
  	$str =~ s/^\s+//;
28
  	$str =~ s/\s+$//;
33
  	$str =~ s/\s+$//;
-
 
34
  	return ($str);
29
  	return ($str);
35
  }