Changes

Jump to navigation Jump to search
520 bytes added ,  09:13, 12 August 2015
Line 60: Line 60:     
Should the $new_config_file already exist or for some reason you can't write to it, esmith::DB->error will return the reason and create() will return false.
 
Should the $new_config_file already exist or for some reason you can't write to it, esmith::DB->error will return the reason and create() will return false.
 +
 +
example for creating and using a custom database in one line:
 +
my $customDB = esmith::ConfigDB->open('YOUR_DATABASE_NAME') || esmith::ConfigDB->create('YOUR_DATABASE_NAME');
 +
 
===== open =====
 
===== open =====
   Line 98: Line 102:     
see also [http://wiki.contribs.org/Esmith::DB::db#creating_a_new_record that page]
 
see also [http://wiki.contribs.org/Esmith::DB::db#creating_a_new_record that page]
 +
 +
 +
for example (if it doesn't exist we create it)
 +
    my $rec = $DB->get('roundcube') || $DB->new_record('roundcube', {type => 'service'});
    
===== get =====
 
===== get =====
Line 106: Line 114:     
If there's no record for the $key it will return false.
 
If there's no record for the $key it will return false.
 +
 +
for example (if it doesn't exist we create it)
 +
    my $rec = $DB->get('roundcube') || $DB->new_record('roundcube', {type => 'service'});
 +
 
===== get_all =====
 
===== get_all =====
   Line 115: Line 127:     
  {
 
  {
 +
      use esmith::HostsDB;
 +
      $DB = esmith::HostsDB->open;
 +
 
       # Purge quoting chars in comments to fix bug 8723 & bug 8806
 
       # Purge quoting chars in comments to fix bug 8723 & bug 8806
 
       foreach my $host ($DB->get_all)
 
       foreach my $host ($DB->get_all)

Navigation menu