diff -Nru libpgobject-perl-2.2.0/Changes libpgobject-perl-2.3.2/Changes --- libpgobject-perl-2.2.0/Changes 2020-08-16 10:45:47.000000000 +0000 +++ libpgobject-perl-2.3.2/Changes 2021-11-07 18:40:24.000000000 +0000 @@ -1,77 +1,97 @@ Revision history for PGObject +2.3.2 2021-11-07 + * `$sth->rows` works for SELECT queries on DBD::Mock *and* DBD::Pg + whereas `$sth->execute()` only returns the number of rows on + DBD::Pg + +2.3.1 2021-11-07 + * Fix test expectation + +2.3.0 2021-11-07 + * Better formatting of COPYRIGHT section in POD + * Update SUPPORT section in POD + * Replace Carp with Carp::Clan for better error reporting + * Improve some error messages to include some context + (notably the object being complained about) + * Remove Try::Tiny module from dependencies (unused) + * Add Log::Any to dependencies for error logging + +2.2.1 2020-08-30 + * MetaCPAN parseable bulleted lists in Changes + 2.2.0 2020-08-16 - Add `rowhash_deserializer` to allocate an efficient row deserializer + * Add `rowhash_deserializer` to allocate an efficient row deserializer as returned from `fetchrow_hashref`. - Fix two Kwalitee 'extra'-category warnings (license, mixed versions) + * Fix two Kwalitee 'extra'-category warnings (license, mixed versions) 2.1.0 2020-08-15 - Add `deserializer` method as a performance optimization for repeated + * Add `deserializer` method as a performance optimization for repeated calls to `deserialize` 2.0.2 2017-08-25 - Code cleanup - Test case improvements - Reduced warnings in test cases in some cases + * Code cleanup + * Test case improvements + * Reduced warnings in test cases in some cases 2.0.1 2017-05-24 - Fixing undeclared dependency in makefile + * Fixing undeclared dependency in makefile 2.0.0 2017-05-19 - Min Perl version is now 5.10 - Broke the deserialization API off to PGObject::Type::Registry (included) - Can now specify PGObject new registries on import - Registries are now fully private and cannot be changed from outside - Moved column deserialization function - Redesigned type registration interface - Old type registration routines deprecated - Old column deserialization function removed + * Min Perl version is now 5.10 + * Broke the deserialization API off to PGObject::Type::Registry (included) + * Can now specify PGObject new registries on import + * Registries are now fully private and cannot be changed from outside + * Moved column deserialization function + * Redesigned type registration interface + * Old type registration routines deprecated + * Old column deserialization function removed 1.403.2 2016-11-21 - Fixing matching of 'asc|desc' sort order specifiers + * Fixing matching of 'asc|desc' sort order specifiers 1.403.1 2016-11-20 - Fixing issue #11: Mapper hints from helpers discarded - Fix call_procedure() 'orderby' syntax errors + * Fixing issue #11: Mapper hints from helpers discarded + * Fix call_procedure() 'orderby' syntax errors 1.402.9 2016-02-13 - Fixing warning in map + * Fixing warning in map 1.402.8 2015-10-10 - Fixing array ref handling, and tightening up ref handling + * Fixing array ref handling, and tightening up ref handling 1.402.7 2015-09-09 - local $@ to hide eval failures from bleeding up + * local $@ to hide eval failures from bleeding up 1.402.6 2014-10-09 - Better exception handling + * Better exception handling 1.402.5 2014-09-07 - Fixed test numbering that caused build failures + * Fixed test numbering that caused build failures 1.402.4 2014-09-05 - Fixed to_db and pgobject_to_db serialization functions (+added tests) + * Fixed to_db and pgobject_to_db serialization functions (+added tests) 1.402.3 2014-09-04 - Supporting both the old pgobject_to_db and the new to_db methods. - More code cleanup + * Supporting both the old pgobject_to_db and the new to_db methods. + * More code cleanup 1.402.2 2014-09-01 - Code cleanup + * Code cleanup 1.402.1 2014-08-21 - Better documentation of memoization uses and misuses. + * Better documentation of memoization uses and misuses. 1.402.0 2014-08-20 - Added optional memoization of database catalog lookups. + * Added optional memoization of database catalog lookups. 1.4.1 2014-03-03 - Fixed type instantiation bug when calling from externally with a + * Fixed type instantiation bug when calling from externally with a named registry 1.4 2014-02-24 1. Added support for arrays and registered types. Note that this does - not parse the array from text format and only handles an array passed + not parse the array from text format and only handles an array passed to it. This paves the way for array-handling composite types, however. 2. DB_TESTING environment variable now used to control database tests, @@ -94,7 +114,7 @@ 1. Minor changes to test cases to let them finish cleanly when the db is not available. 2. Minor documentation changes. - + 1.00 2013-05-24 First version, released on an unsuspecting world. Differences from LedgerSMB's interface include: diff -Nru libpgobject-perl-2.2.0/debian/changelog libpgobject-perl-2.3.2/debian/changelog --- libpgobject-perl-2.2.0/debian/changelog 2020-08-19 15:32:32.000000000 +0000 +++ libpgobject-perl-2.3.2/debian/changelog 2021-11-08 17:35:35.000000000 +0000 @@ -1,3 +1,18 @@ +libpgobject-perl (2.3.2-1) unstable; urgency=medium + + * Team upload. + + [ Debian Janitor ] + * Update standards version to 4.5.1, no changes needed. + + [ gregor herrmann ] + * Import upstream version 2.3.2. + * Update years of upstream and packaging copyright. + * Update test and runtime dependencies. + * Declare compliance with Debian Policy 4.6.0. + + -- gregor herrmann Mon, 08 Nov 2021 18:35:35 +0100 + libpgobject-perl (2.2.0-1) unstable; urgency=medium * Team upload. diff -Nru libpgobject-perl-2.2.0/debian/control libpgobject-perl-2.3.2/debian/control --- libpgobject-perl-2.2.0/debian/control 2020-08-19 15:32:32.000000000 +0000 +++ libpgobject-perl-2.3.2/debian/control 2021-11-08 17:35:35.000000000 +0000 @@ -5,15 +5,16 @@ Testsuite: autopkgtest-pkg-perl Priority: optional Build-Depends: debhelper-compat (= 13) -Build-Depends-Indep: libdbd-pg-perl , +Build-Depends-Indep: libcarp-clan-perl , + libdbd-pg-perl , liblist-moreutils-perl , + liblog-any-perl , libscalar-list-utils-perl , libtest-exception-perl , libtest-pod-coverage-perl , libtest-pod-perl , - libtry-tiny-perl , perl -Standards-Version: 4.5.0 +Standards-Version: 4.6.0 Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libpgobject-perl Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libpgobject-perl.git Homepage: https://metacpan.org/release/PGObject/ @@ -23,10 +24,11 @@ Architecture: all Depends: ${misc:Depends}, ${perl:Depends}, + libcarp-clan-perl, libdbd-pg-perl, liblist-moreutils-perl, - libscalar-list-utils-perl, - libtry-tiny-perl + liblog-any-perl, + libscalar-list-utils-perl Description: base class for PG Object subclasses PGObject contains the base routines for object management using discoverable stored procedures in PostgreSQL databases. PGObject contains only common diff -Nru libpgobject-perl-2.2.0/debian/copyright libpgobject-perl-2.3.2/debian/copyright --- libpgobject-perl-2.2.0/debian/copyright 2020-08-19 15:32:32.000000000 +0000 +++ libpgobject-perl-2.3.2/debian/copyright 2021-11-08 17:35:35.000000000 +0000 @@ -5,14 +5,14 @@ Files: * Copyright: 2013-2014, Chris Travers - 2017-2020, The LedgerSMB Core Team + 2014-2021, The LedgerSMB Core Team License: BSD-2-clause Files: debian/* Copyright: 2013-2017, Robert James Clay 2016, Lucas Kanashiro 2014-2020, Salvatore Bonaccorso - 2015-2016, gregor herrmann + 2015-2021, gregor herrmann 2013, Axel Beckert License: BSD-2-clause diff -Nru libpgobject-perl-2.2.0/lib/PGObject/Type/Registry.pm libpgobject-perl-2.3.2/lib/PGObject/Type/Registry.pm --- libpgobject-perl-2.2.0/lib/PGObject/Type/Registry.pm 2020-08-16 10:45:57.000000000 +0000 +++ libpgobject-perl-2.3.2/lib/PGObject/Type/Registry.pm 2021-11-07 14:57:35.000000000 +0000 @@ -29,13 +29,13 @@ use warnings; -use Carp; +use Carp::Clan qr/^PGObject\b/; use List::MoreUtils qw(pairwise); +use Log::Any qw($log); use Scalar::Util qw(reftype); -use Try::Tiny; -our $VERSION = '2.2.0'; +our $VERSION = '2.3.1'; my %registry = ( default => {} ); @@ -94,14 +94,17 @@ sub register_type { my ( $self, %args ) = @_; my %defaults = ( registry => 'default' ); - carp 'Using default registry' unless $args{registry}; - croak 'Must provide dbtype arg' unless $args{dbtype}; - croak 'Must provide apptype arg' unless $args{apptype}; + carp $log->warn( 'Using default registry' ) + unless $args{registry}; + croak $log->error( 'Missing dbtype arg' ) + unless $args{dbtype}; + croak $log->error( 'Missing apptype arg' ) + unless $args{apptype}; delete $args{registry} unless defined $args{registry}; %args = ( %defaults, %args ); - croak 'Registry does not exist yet' + croak $log->error( 'Registry does not exist yet' ) unless exists $registry{ $args{registry} }; - croak 'Type registered with different target' + croak $log->error( 'Type registered with different target' ) if exists $registry{ $args{registry} }->{ $args{dbtype} } and $registry{ $args{registry} }->{ $args{dbtype} } ne $args{apptype}; $args{apptype} =~ /^(.*)::(\w*)$/; @@ -123,7 +126,7 @@ =head1 UNREGISTERING A TYPE To unregister a type, you provide the dbtype and registry information, both -of which are required. Note that at that this is rarely needed. +of which are required. Note that at this time this is rarely needed. =head2 unregister_type @@ -131,11 +134,13 @@ sub unregister_type { my ( $self, %args ) = @_; - croak 'Must provide registry' unless $args{registry}; - croak 'Must provide dbtype arg' unless $args{dbtype}; - croak 'Registry does not exist yet' + croak $log->error( 'Missing registry' ) + unless $args{registry}; + croak $log->error( 'Missing dbtype arg' ) + unless $args{dbtype}; + croak $log->error( 'Registry does not exist yet' ) unless exists $registry{ $args{registry} }; - croak 'Type not registered' + carp $log->warn( 'Type not registered' ) unless $registry{ $args{registry} }->{ $args{dbtype} }; delete $registry{ $args{registry} }->{ $args{dbtype} }; } @@ -157,7 +162,8 @@ sub deserialize { my ( $self, %args ) = @_; - croak "Must specify dbstring arg" unless exists $args{dbstring}; + croak $log->error( "Missing dbstring arg" ) + unless exists $args{dbstring}; return $self->deserializer( %args )->( $args{dbstring} ); } @@ -182,8 +188,10 @@ sub deserializer { my ( $self, %args ) = @_; my %defaults = ( registry => 'default' ); - carp 'No registry specified, using default' unless exists $args{registry}; - croak "Must specify dbtype arg" unless $args{dbtype}; + carp $log->info( 'No registry specified, using default' ) + unless exists $args{registry}; + croak $log->error( "Missing dbtype arg" ) + unless $args{dbtype}; %args = ( %defaults, %args ); my $arraytype = 0; if ( $args{dbtype} =~ /^_/ ) { @@ -229,14 +237,17 @@ sub rowhash_deserializer { my ( $self, %args ) = @_; my %defaults = ( registry => 'default' ); - carp 'No registry specified, using default' unless exists $args{registry}; - croak 'No types specied' unless exists $args{types}; + carp $log->warn( 'No registry specified, using default' ) + unless exists $args{registry}; + croak $log->error( 'No types specied' ) + unless exists $args{types}; %args = ( %defaults, %args ); my $types = $args{types}; if (reftype $types eq 'ARRAY') { - croak 'No columns specified' unless exists $args{columns}; + croak $log->error( 'No columns specified' ) + unless exists $args{columns}; $types = { pairwise { $a => $b } @{$args{columns}}, @$types }; } @@ -274,8 +285,10 @@ sub inspect { my ( $self, $name ) = @_; - croak 'Must specify a name' unless $name; - croak 'Registry does not exist' unless exists $registry{$name}; + croak $log->error( 'Must specify a name' ) + unless $name; + croak $log->error( 'Registry does not exist' ) + unless exists $registry{$name}; return { %{ $registry{$name} } }; } @@ -291,7 +304,7 @@ =head1 COPYRIGHT AND LICENSE -COPYRIGHT (C) 2017-2020 The LedgerSMB Core Team +COPYRIGHT (C) 2017-2021 The LedgerSMB Core Team Redistribution and use in source and compiled forms with or without modification, are permitted provided that the following conditions are met: diff -Nru libpgobject-perl-2.2.0/lib/PGObject.pm libpgobject-perl-2.3.2/lib/PGObject.pm --- libpgobject-perl-2.2.0/lib/PGObject.pm 2020-08-16 10:51:25.000000000 +0000 +++ libpgobject-perl-2.3.2/lib/PGObject.pm 2021-11-07 17:29:17.000000000 +0000 @@ -6,22 +6,24 @@ =cut package PGObject; + use strict; use warnings; -use Carp; +use Carp::Clan qr/^PGObject\b/; +use Log::Any qw($log); use Memoize; -use PGObject::Type::Registry; -use List::MoreUtils qw/pairwise/; + +use PGObject::Type::Registry; =head1 VERSION -Version 2.2.0 +Version 2.3.2 =cut -our $VERSION = '2.2.0'; +our $VERSION = '2.3.2'; =head1 SYNPOSIS @@ -178,7 +180,7 @@ $args{funcname} = $args{funcprefix} . $args{funcname}; $args{argschema} ||= 'public'; - my $dbh = $args{dbh} || croak 'No dbh provided'; + my $dbh = $args{dbh} || croak $log->error( 'No dbh provided' ); my $query = qq| SELECT proname, pronargs, proargnames, @@ -204,10 +206,26 @@ my $sth = $dbh->prepare($query) || die $!; $sth->execute(@queryargs) || die $dbh->errstr . ": " . $query; + my $rows = $sth->rows; + if ($rows > 1) { + if ($args{argtype1}) { + croak $log->fatalf( + 'Ambiguous criteria discovering function %s.%s (with first argument type %s)', + $args{funcschema}, $args{funcname}, $args{argtype1} + ); + } + else { + croak $log->fatalf( + 'Ambiguous criteria discovering function %s.%s', + $args{funcschema}, $args{funcname} + ); + } + } + elsif ($rows == 0) { + croak $log->fatalf( 'No such function: %s.%s', + $args{funcschema}, $args{funcname} ); + } my $ref = $sth->fetchrow_hashref('NAME_lc'); - croak "transaction already aborted" if $dbh->state eq '25P02'; - croak "No such function" if !$ref; - croak 'Ambiguous discovery criteria' if $sth->fetchrow_hashref('NAME_lc'); my $f_args; for my $n ( @{ $ref->{proargnames} } ) { @@ -282,8 +300,10 @@ $args{registry} ||= 'default'; my $dbh = $args{dbh}; - croak "No database handle provided" unless $dbh; - croak "dbh not a database handle" unless eval { $dbh->isa('DBI::db') }; + croak $log->error( "No database handle provided" ) + unless $dbh; + croak $log->error( "dbh not a database handle" ) + unless eval { $dbh->isa('DBI::db') }; my $wf_string = ''; @@ -391,7 +411,7 @@ sub new_registry { my ( $self, $registry_name ) = @_; - carp "Deprecated use of PGObject->new_registry()"; + carp $log->warn( "Deprecated use of PGObject->new_registry()" ); PGObject::Type::Registry->new_registry($registry_name); } @@ -414,7 +434,7 @@ =cut sub register_type { - carp 'Use of deprecated method register_type of PGObject module'; + carp $log->warn( 'Use of deprecated method register_type of PGObject module' ); my ( $self, %args ) = @_; PGObject::Type::Registry->register_type( @@ -437,7 +457,7 @@ =cut sub unregister_type { - carp 'Use of deprecated method unregister_type of PGObject'; + carp $log->warn( 'Use of deprecated method unregister_type of PGObject' ); my ( $self, %args ) = @_; $args{registry} ||= 'default'; @@ -605,17 +625,9 @@ L -=item * AnnoCPAN: Annotated CPAN documentation - -L - -=item * CPAN Ratings - -L - -=item * Search CPAN +=item * MetaCPAN -L +L =back @@ -642,8 +654,8 @@ =head1 COPYRIGHT -COPYRIGHT (C) 2013-2014 Chris Travers -COPYRIGHT (C) 2014-2017 The LedgerSMB Core Team + COPYRIGHT (C) 2013-2014 Chris Travers + COPYRIGHT (C) 2014-2021 The LedgerSMB Core Team Redistribution and use in source and compiled forms with or without modification, are permitted provided that the following conditions are met: diff -Nru libpgobject-perl-2.2.0/Makefile.PL libpgobject-perl-2.3.2/Makefile.PL --- libpgobject-perl-2.2.0/Makefile.PL 2020-08-16 10:45:47.000000000 +0000 +++ libpgobject-perl-2.3.2/Makefile.PL 2021-10-31 21:51:19.000000000 +0000 @@ -14,15 +14,16 @@ ? ('LICENSE'=> 'bsd') : ()), PREREQ_PM => { - 'DBD::Pg' => 2.0, - 'Try::Tiny' => 0, - 'Memoize' => 0, - 'List::MoreUtils' => 0.07, + 'Carp::Clan' => 0, + 'DBD::Pg' => 2.0, + 'Memoize' => 0, + 'Log::Any' => 0, + 'List::MoreUtils' => 0.07, }, TEST_REQUIRES => { - 'Test::More' => 0, - 'Test::Exception' => 0, - }, + 'Test::More' => 0, + 'Test::Exception' => 0, + }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'PGObject-*' }, META_MERGE => { diff -Nru libpgobject-perl-2.2.0/META.json libpgobject-perl-2.3.2/META.json --- libpgobject-perl-2.2.0/META.json 2020-08-16 10:58:40.000000000 +0000 +++ libpgobject-perl-2.3.2/META.json 2021-11-07 18:40:28.000000000 +0000 @@ -4,13 +4,13 @@ "Chris Travers " ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter version 2.150005", + "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", "license" : [ "bsd" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", - "version" : "2" + "version" : 2 }, "name" : "PGObject", "no_index" : { @@ -32,10 +32,11 @@ }, "runtime" : { "requires" : { + "Carp::Clan" : "0", "DBD::Pg" : "2", "List::MoreUtils" : "0.07", + "Log::Any" : "0", "Memoize" : "0", - "Try::Tiny" : "0", "perl" : "5.010" } }, @@ -54,6 +55,6 @@ "web" : "https://github.com/ledgersmb/PGObject" } }, - "version" : "v2.2.0", - "x_serialization_backend" : "JSON::PP version 2.27300_01" + "version" : "v2.3.2", + "x_serialization_backend" : "JSON::PP version 4.02" } diff -Nru libpgobject-perl-2.2.0/META.yml libpgobject-perl-2.3.2/META.yml --- libpgobject-perl-2.2.0/META.yml 2020-08-16 10:58:40.000000000 +0000 +++ libpgobject-perl-2.3.2/META.yml 2021-11-07 18:40:28.000000000 +0000 @@ -9,7 +9,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter version 2.150005' +generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' license: bsd meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -20,12 +20,13 @@ - t - inc requires: + Carp::Clan: '0' DBD::Pg: '2' List::MoreUtils: '0.07' + Log::Any: '0' Memoize: '0' - Try::Tiny: '0' perl: '5.010' resources: repository: https://github.com/ledgersmb/PGObject.git -version: v2.2.0 +version: v2.3.2 x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -Nru libpgobject-perl-2.2.0/README libpgobject-perl-2.3.2/README --- libpgobject-perl-2.2.0/README 2020-08-15 11:23:38.000000000 +0000 +++ libpgobject-perl-2.3.2/README 2021-10-31 21:31:52.000000000 +0000 @@ -16,10 +16,10 @@ To install this module, run the following commands: - perl Makefile.PL - make - make test - make install + perl Makefile.PL + make + make test + make install SUPPORT AND DOCUMENTATION @@ -31,16 +31,10 @@ You can also look for information at: RT, CPAN's request tracker (report bugs here) - http://rt.cpan.org/NoAuth/Bugs.html?Dist=PGObject + https://rt.cpan.org/NoAuth/Bugs.html?Dist=PGObject - AnnoCPAN, Annotated CPAN documentation - http://annocpan.org/dist/PGObject - - CPAN Ratings - http://cpanratings.perl.org/d/PGObject - - Search CPAN - http://search.cpan.org/dist/PGObject/ + MetaCPAN + https://metacpan.org/dist/PGObject WRITING PGOBJECT-AWARE PERL CLASSES @@ -87,7 +81,8 @@ LICENSE AND COPYRIGHT -Copyright (C) 2013 Chris Travers + COPYRIGHT (C) 2013-2014 Chris Travers + COPYRIGHT (C) 2014-2021 The LedgerSMB Core Team Redistribution and use in source and compiled forms with or without modification, are permitted provided that the following conditions are met: diff -Nru libpgobject-perl-2.2.0/README.md libpgobject-perl-2.3.2/README.md --- libpgobject-perl-2.2.0/README.md 2020-08-15 11:23:38.000000000 +0000 +++ libpgobject-perl-2.3.2/README.md 2021-10-31 21:24:15.000000000 +0000 @@ -16,10 +16,10 @@ To install this module, run the following commands: - perl Makefile.PL - make - make test - make install + perl Makefile.PL + make + make test + make install SUPPORT AND DOCUMENTATION @@ -31,16 +31,10 @@ You can also look for information at: RT, CPAN's request tracker (report bugs here) - http://rt.cpan.org/NoAuth/Bugs.html?Dist=PGObject + https://rt.cpan.org/NoAuth/Bugs.html?Dist=PGObject - AnnoCPAN, Annotated CPAN documentation - http://annocpan.org/dist/PGObject - - CPAN Ratings - http://cpanratings.perl.org/d/PGObject - - Search CPAN - http://search.cpan.org/dist/PGObject/ + MetaCPAN + https://metacpan.org/dist/PGObject WRITING PGOBJECT-AWARE PERL CLASSES @@ -87,7 +81,8 @@ LICENSE AND COPYRIGHT -Copyright (C) 2013 Chris Travers + COPYRIGHT (C) 2013-2014 Chris Travers + COPYRIGHT (C) 2014-2021 The LedgerSMB Core Team Redistribution and use in source and compiled forms with or without modification, are permitted provided that the following conditions are met: diff -Nru libpgobject-perl-2.2.0/t/03-legacy_registry.t libpgobject-perl-2.3.2/t/03-legacy_registry.t --- libpgobject-perl-2.2.0/t/03-legacy_registry.t 2020-08-15 20:45:53.000000000 +0000 +++ libpgobject-perl-2.3.2/t/03-legacy_registry.t 2021-11-07 14:40:49.000000000 +0000 @@ -30,7 +30,7 @@ 'Correction exception thrown, reregistering in nonexistent registry.'; ok(PGObject->unregister_type(pg_type => 'foo'), 'Unregister type, try 1'); -dies_ok(sub {PGObject->unregister_type(pg_type => 'foo')}, 'Unregister type, try 2'); +lives_ok(sub {PGObject->unregister_type(pg_type => 'foo')}, 'Unregister type, try 2'); is(PGObject->register_type(pg_type => 'foo', perl_class => 'Foo2'), 1, "Repeat type registration, different type, succeeds now");