From a36ceb6b415e99bf24e2fbde72035650a8f4d3af Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Wed, 24 Jan 2024 23:03:05 +0000 Subject: [PATCH] Get rid of auto-documentation for Data::Domain::Dependencies, because an incompatible API change in Data::Domain broke it, and I can't easily fix it without breaking my own API. --- CHANGELOG | 5 ++++ lib/Data/Domain/Dependencies.pm | 26 ++++++++----------- lib/Params/Validate/Dependencies.pm | 2 +- .../Validate/Dependencies/Documenter.pm | 2 +- .../Validate/Dependencies/Extending.pod | 6 ++--- t/04-autodoco-dd.t | 23 ---------------- t/05-extra-validator-without-doco.t | 8 ------ t/06-extra-validator-with-doco.t | 11 -------- t/git-issue-5-exclusively.t | 5 ---- 9 files changed, 20 insertions(+), 68 deletions(-) delete mode 100644 t/04-autodoco-dd.t diff --git a/CHANGELOG b/CHANGELOG index 4392298..e10afac 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +2.00 2024-01-24 + +- An API change in Data::Domain 1.14 broke auto-documentation, so that is no + longer supported in Data::Domain::Dependencies. + 1.41 2023-04-23 - Add test to prove that literal back-slashes aren't a problem in auto-doco diff --git a/lib/Data/Domain/Dependencies.pm b/lib/Data/Domain/Dependencies.pm index a4646f8..e254df5 100644 --- a/lib/Data/Domain/Dependencies.pm +++ b/lib/Data/Domain/Dependencies.pm @@ -10,7 +10,7 @@ use Exporter qw(import); use base qw(Data::Domain); use vars qw($VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS); -$VERSION = '1.41'; +$VERSION = '2.00'; @EXPORT = (); @EXPORT_OK = ( @@ -32,6 +32,16 @@ functions as Params::Validate::Dependencies. NB now this only works on perl 5.18 and higher as Data::Domain uses some features of more modern perls. +=head1 INCOMPATIBLE CHANGES + +As of version 2.00, Data::Domain::Dependencies no longer has the +C method. This is because of incompatible +changes in the L API. If you need this method then +you should use Data::Domain::Dependencies version 1.41, and +Data::Domain version 1.13. + +See L + =head1 SYNOPSIS This creates a domain which, when passed a hashref to inspect, will @@ -98,20 +108,6 @@ sub new { } } -=head2 generate_documentation - -This is an additional method, not found in Data::Domain, which -generates vaguely readable -documentation for the domain. Broadly speaking, it spits out the -source code. - -=cut - -sub generate_documentation { - my $self = shift; - $self->_document(); -} - # this is where the magic happens ... sub inspect { my $sub = shift; diff --git a/lib/Params/Validate/Dependencies.pm b/lib/Params/Validate/Dependencies.pm index 5219d22..b5f1d78 100644 --- a/lib/Params/Validate/Dependencies.pm +++ b/lib/Params/Validate/Dependencies.pm @@ -13,7 +13,7 @@ use base qw(Exporter); use vars qw($VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS $DOC); -$VERSION = '1.41'; +$VERSION = '2.00'; $DOC = 0; # copy and update P::V's EXPORT* constants diff --git a/lib/Params/Validate/Dependencies/Documenter.pm b/lib/Params/Validate/Dependencies/Documenter.pm index b203b64..5639642 100644 --- a/lib/Params/Validate/Dependencies/Documenter.pm +++ b/lib/Params/Validate/Dependencies/Documenter.pm @@ -4,7 +4,7 @@ use strict; use warnings; use vars qw($VERSION); -$VERSION = '1.41'; +$VERSION = '2.00'; use Scalar::Util qw(blessed); diff --git a/lib/Params/Validate/Dependencies/Extending.pod b/lib/Params/Validate/Dependencies/Extending.pod index 16d2e84..53e1d10 100644 --- a/lib/Params/Validate/Dependencies/Extending.pod +++ b/lib/Params/Validate/Dependencies/Extending.pod @@ -15,8 +15,8 @@ understand objects in perl. =head1 WHAT THE *_of FUNCTIONS REALLY DO -If you've read the documentation for Params::Validate::Dependencies -and Data::Domain::Dependencies, then you'd think that they return +If you've read the documentation for Params::Validate::Dependencies, +then you'd think that it returns a code-ref which is a closure over the original arguments, and that they're implemented something like this: @@ -190,8 +190,6 @@ things may happen: L -L - =head1 SOURCE CODE REPOSITORY L diff --git a/t/04-autodoco-dd.t b/t/04-autodoco-dd.t deleted file mode 100644 index f753187..0000000 --- a/t/04-autodoco-dd.t +++ /dev/null @@ -1,23 +0,0 @@ -use strict; -use warnings; - -use Test::More ( - $] <= 5.018 ? (skip_all => 'only on perl 5.18 and higher') : () -); -END { done_testing(); } - -use Data::Domain::Dependencies qw(:all); - -my $domain = Dependencies( - any_of( - qw(alpha beta), - all_of(qw(foo bar), none_of('barf')), - one_of(qw(quux garbleflux)) - ) -); - -is( - $domain->generate_documentation(), - "any of ('alpha', 'beta', all of ('foo', 'bar' and none of ('barf')) or one of ('quux' or 'garbleflux'))", - "Data::Domain::Dependencies doco also works" -); diff --git a/t/05-extra-validator-without-doco.t b/t/05-extra-validator-without-doco.t index 95c9eb1..1247e98 100644 --- a/t/05-extra-validator-without-doco.t +++ b/t/05-extra-validator-without-doco.t @@ -36,14 +36,6 @@ SKIP: { my $domain = Dependencies(@pvd); ok(!$domain->inspect({alpha => 1, gamma => 1}), "DDD: correct params"); ok($domain->inspect({alpha => 1, beta => 1, gamma => 1}), "DDD: incorrect params"); - - dies_ok(sub { $domain->generate_documentation() }, - "DDD: can't document the undoccable"); - is( - Dependencies(one_of('foo', two_of('bar')))->generate_documentation(), - "one of ('foo' or [coderef does not support autodoc])", - 'DDD auto-doc also detects un-doccable stuff deep down in the tree' - ); } sub two_of { diff --git a/t/06-extra-validator-with-doco.t b/t/06-extra-validator-with-doco.t index c2862e9..f640a10 100644 --- a/t/06-extra-validator-with-doco.t +++ b/t/06-extra-validator-with-doco.t @@ -41,17 +41,6 @@ SKIP: { my $domain = Dependencies(@pvd); ok(!$domain->inspect({alpha => 1, gamma => 1}), "DDD: correct params"); ok($domain->inspect({alpha => 1, beta => 1, gamma => 1}), "DDD: incorrect params"); - - is( - $domain->generate_documentation(), - "two of ('alpha' or one of ('beta' or 'gamma'))", - 'DDD: auto-doc does tree jibber-jabber' - ); - is( - Dependencies(one_of('foo', two_of(qw(bar baz barf))))->generate_documentation(), - "one of ('foo' or two of ('bar', 'baz' or 'barf'))", - "DDD: auto-doc does tree jibber-jabber t'other way round too" - ); } sub foo { diff --git a/t/git-issue-5-exclusively.t b/t/git-issue-5-exclusively.t index 30be9f6..563b76a 100644 --- a/t/git-issue-5-exclusively.t +++ b/t/git-issue-5-exclusively.t @@ -59,9 +59,4 @@ SKIP: { $domain->inspect({ bollocks => 1, foo => 1, bar => 1 }), 'exclusively() fails when excess baggage is present using DDD' ); -is( - $domain->generate_documentation(), - "exclusively (any of ('alpha', 'beta', 'key with spaces', 'single\\'quote', all of ('foo', 'bar' and none of ('barf')) or one of ('quux' or 'garbleflux')))", - "doco for exclusively() works in DDD" -); }