Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Revision history for PGObject-Type-ByteString

1.2.0 2017-05-16
Adds support for PGObject 2.x
1.1.2 2016-12-04
Fix copyright attribution in LICENSE (consistency)

Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
^tmp
\bTAGS$
^MYMETA.yml$
^.travis.yml$
^MYMETA.json$

\bSu-[\d\.\_]+

Expand Down
17 changes: 11 additions & 6 deletions lib/PGObject/Type/ByteString.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ Version 1.1.2

=cut

our $VERSION = '1.1.2';

our $VERSION = '1.2.0';

=head1 SYNOPSIS

Expand Down Expand Up @@ -48,10 +47,16 @@ sub register {
my $types = $args{types};
$types = [ DBD::Pg::PG_BYTEA, 'bytea' ] unless defined $types and @$types;
for my $type (@$types){
my $ret =
PGObject->register_type(registry => $registry, pg_type => $type,
perl_class => $self);
return $ret unless $ret;
if ($PGObject::VERSION =~ /^1\./){
my $ret =
PGObject->register_type(registry => $registry, pg_type => $type,
perl_class => $self);
return $ret unless $ret;
} else {
PGObject::Type::Registry->register_type(
registry => $registry, dbtype => $type, apptype => $self
);
}
}
return 1;
}
Expand Down
9 changes: 8 additions & 1 deletion t/02-registration.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ ok(PGObject::Type::ByteString->register(registry => 'test',
'custom registry, mybytes registration'),
ok(PGObject::Type::ByteString->register(registry => 'test'),
'default types, custom registry');
my $registry = PGObject::get_type_registry();
my $registry;

if ($PGObject::VERSION =~ /^1\./){
$registry = PGObject::get_type_registry();
} else {
$registry = { map {$_ => PGObject::Type::Registry->inspect($_) }
qw(default test) };
}
for my $reg (qw(default test)){
for my $type (PG_BYTEA, 'mybytes') {
is($registry->{$reg}->{$type}, 'PGObject::Type::ByteString',
Expand Down