61d243c42a737bce0bbc7744236416c42705d737
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / DestroyWarning.pm
1 package # hide from PAUSE
2     DBIx::Class::CDBICompat::DestroyWarning;
3
4 use strict;
5 use warnings;
6 use DBIx::Class::_Util 'detected_reinvoked_destructor';
7 use namespace::clean;
8
9 sub DESTROY {
10   return if &detected_reinvoked_destructor;
11
12   my ($self) = @_;
13   my $class = ref $self;
14   warn "$class $self destroyed without saving changes to "
15          .join(', ', keys %{$self->{_dirty_columns} || {}})
16     if keys %{$self->{_dirty_columns} || {}};
17 }
18
19 1;