Skip to content

Commit

Permalink
Get rid of auto-documentation for Data::Domain::Dependencies, because…
Browse files Browse the repository at this point in the history
… an incompatible API change in Data::Domain broke it, and I can't easily fix it without breaking my own API.
  • Loading branch information
DrHyde committed Jan 24, 2024
1 parent c5b731c commit a36ceb6
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 68 deletions.
5 changes: 5 additions & 0 deletions 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
Expand Down
26 changes: 11 additions & 15 deletions lib/Data/Domain/Dependencies.pm
Expand Up @@ -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 = (
Expand All @@ -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<generate_documentation> method. This is because of incompatible
changes in the L<Data::Domain> API. If you need this method then
you should use Data::Domain::Dependencies version 1.41, and
Data::Domain version 1.13.
See L<https://github.com/DrHyde/perl-modules-Params-Validate-Dependencies/issues/28>
=head1 SYNOPSIS
This creates a domain which, when passed a hashref to inspect, will
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/Params/Validate/Dependencies.pm
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/Params/Validate/Dependencies/Documenter.pm
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;

use vars qw($VERSION);
$VERSION = '1.41';
$VERSION = '2.00';

use Scalar::Util qw(blessed);

Expand Down
6 changes: 2 additions & 4 deletions lib/Params/Validate/Dependencies/Extending.pod
Expand Up @@ -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:

Expand Down Expand Up @@ -190,8 +190,6 @@ things may happen:

L<Params::Validate::Dependencies>

L<Data::Domain::Dependencies>

=head1 SOURCE CODE REPOSITORY

L<git://github.com/DrHyde/perl-modules-Params-Validate-Dependencies.git>
Expand Down
23 changes: 0 additions & 23 deletions t/04-autodoco-dd.t

This file was deleted.

8 changes: 0 additions & 8 deletions t/05-extra-validator-without-doco.t
Expand Up @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions t/06-extra-validator-with-doco.t
Expand Up @@ -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 {
Expand Down
5 changes: 0 additions & 5 deletions t/git-issue-5-exclusively.t
Expand Up @@ -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"
);
}

0 comments on commit a36ceb6

Please sign in to comment.