Skip to content

Commit

Permalink
clean up nasty old code that used UNIVERSAL
Browse files Browse the repository at this point in the history
  • Loading branch information
DrHyde committed Sep 27, 2016
1 parent 44d0ee5 commit 55766a9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
@@ -1,3 +1,5 @@
2016-09-27 1.04 Clean up some nasty old code, no functional changes

2015-11-22 1.03 Fix tests to work with perl 5.22 and higher

2008-06-16 1.02 Remove more 'use diagnostics' (and forgot to update
Expand Down
1 change: 1 addition & 0 deletions Makefile.PL
Expand Up @@ -10,6 +10,7 @@ WriteMakefile(
},
VERSION_FROM => 'lib/Data/Transactional.pm',
PREREQ_PM => {
'Scalar::Util' => 0,
Storable => 2.07, # we use dclone()
'Data::Compare' => 0.11, # used for testing,
# and by D:C:Plugins:D:T
Expand Down
6 changes: 3 additions & 3 deletions lib/Data/Compare/Plugins/Data/Transactional.pm
Expand Up @@ -4,9 +4,9 @@ use strict;
use warnings;

use Data::Compare;
use UNIVERSAL;
use Scalar::Util qw(blessed);

our $VERSION = '1.03';
our $VERSION = '1.04';

sub _register {
return
Expand All @@ -24,7 +24,7 @@ sub _dt_dt_compare {

sub _dt_notdt_compare {
my($dt, $notdt) = @_;
($dt, $notdt) = ($notdt, $dt) if(!UNIVERSAL::isa($dt, 'Data::Transactional'));
($dt, $notdt) = ($notdt, $dt) if(!(blessed($dt) && $dt->isa('Data::Transactional')));
Compare(_underlying($dt), $notdt);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Data/Transactional.pm
Expand Up @@ -3,7 +3,7 @@ package Data::Transactional;
use strict;
use warnings;

our $VERSION = '1.03';
our $VERSION = '1.04';

use Data::Dumper;

Expand Down
10 changes: 5 additions & 5 deletions t/04_dt_magic.t
Expand Up @@ -5,21 +5,21 @@ use warnings;

use Data::Dumper;
use Data::Compare;
use Test::More tests => 16;
use Scalar::Util qw(blessed);
use Test::More tests => 17;

use UNIVERSAL;
use Data::Transactional;

my $tied = Data::Transactional->new(type => 'array');

ok(UNIVERSAL::isa($tied, 'Data::Transactional'), "object has right type");
ok(ref($tied) eq 'Data::Transactional', "array object has right type");
foreach my $method (qw(rollback commit checkpoint commit_all rollback_all)) {
ok(UNIVERSAL::can($tied, $method), "got a $method method");
ok($tied->can($method), "got a $method method");
}

ok(Compare($tied, []), "newly created transactional array is empty");

$tied = Data::Transactional->new(); # hash
ok(ref($tied) eq 'Data::Transactional', "hash object has right type");
ok(Compare($tied, {}), "newly created transactional hash is empty");

eval { $tied->rollback(); };
Expand Down

0 comments on commit 55766a9

Please sign in to comment.