[svn:dbi] r13956 - in dbi/trunk: . lib/DBI

[email protected]
Newsgroups perl.dbi.changes
Message-ID <[email protected]>
Author: timbo
Date: Fri May  7 05:21:45 2010
New Revision: 13956

Modified:
   dbi/trunk/Changes
   dbi/trunk/lib/DBI/ProfileDumper.pm

Log:
Changed DBI::ProfileDumper to rename any existing profile file by
appending .prev, instead of overwriting it.


Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes	(original)
+++ dbi/trunk/Changes	Fri May  7 05:21:45 2010
@@ -6,11 +6,14 @@
 
 =cut
 
-=head2 Changes in DBI 1.613
+=head2 Changes in DBI 1.612
 
   Fixed DBD::DBM breakage with SQL::Statement (Jens Rehsack)
   Fixed DBD::File leaks file handles (Jens Rehsack)
 
+  Changed DBI::ProfileDumper to rename any existing profile file by
+    appending .prev, instead of overwriting it.
+
 =head2 Changes in DBI 1.611 (svn r13935) 29th April 2010
 
   NOTE: minimum perl version is now 5.8.1 (as announced in DBI 1.607)

Modified: dbi/trunk/lib/DBI/ProfileDumper.pm
==============================================================================
--- dbi/trunk/lib/DBI/ProfileDumper.pm	(original)
+++ dbi/trunk/lib/DBI/ProfileDumper.pm	Fri May  7 05:21:45 2010
@@ -201,6 +201,9 @@
     # provide a default filename
     $self->filename("dbi.prof") unless $self->filename;
 
+    DBI->trace_msg("$self: @{[ %$self ]}\n",0)
+        if $self->{Trace} && $self->{Trace} >= 2;
+
     return $self;
 }
 
@@ -237,6 +240,12 @@
           or croak("Unable to open '$filename' for $class output: $!");
     } else {
         # create new file (or overwrite existing)
+        if (-f $filename) {
+            my $bak = $filename.'.prev';
+            unlink($bak);
+            rename($filename, $bak)
+                or warn "Error renaming $filename to $bak: $!\n";
+        }
         open($fh, ">", $filename) 
           or croak("Unable to open '$filename' for $class output: $!");
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.