From: Peter Rabbitson Date: Sun, 7 Mar 2010 01:58:09 +0000 (+0000) Subject: Unmark Opt::Deps experimental and add extra method as per RT55211 X-Git-Tag: v0.08121~77 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e3fc11e1540ac502176358aac2d2df20c7d90d7f;p=dbsrgits%2FDBIx-Class.git Unmark Opt::Deps experimental and add extra method as per RT55211 --- diff --git a/Changes b/Changes index 791d918..4495626 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for DBIx::Class - DBIx::Class::InflateColumn::File entered deprecated state + - DBIx::Class::Optional::Dependencies left experimental state + - Add req_group_list to Opt::Deps (RT#55211) - Cascading delete/update are now wrapped in a transaction for atomicity - Fix regression where SQL files with comments were not diff --git a/Makefile.PL b/Makefile.PL index d14e185..9d087b2 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -78,7 +78,7 @@ EOW require DBIx::Class::Optional::Dependencies; $reqs->{test_requires} = { %{$reqs->{test_requires}}, - %{DBIx::Class::Optional::Dependencies->_all_optional_requirements}, + map { %$_ } (values %{DBIx::Class::Optional::Dependencies->req_group_list}), }; } diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index f8800a8..6e46f91 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -195,10 +195,6 @@ my $reqs = { }; -sub _all_optional_requirements { - return { map { %{ $reqs->{$_}{req} || {} } } (keys %$reqs) }; -} - sub req_list_for { my ($class, $group) = @_; @@ -281,7 +277,11 @@ sub _check_deps { } } -# This is to be called by the author onbly (automatically in Makefile.PL) +sub req_group_list { + return { map { $_ => { %{ $reqs->{$_}{req} || {} } } } (keys %$reqs) }; +} + +# This is to be called by the author only (automatically in Makefile.PL) sub _gen_pod { my $class = shift; my $modfn = __PACKAGE__ . '.pm'; @@ -289,6 +289,8 @@ sub _gen_pod { require DBIx::Class; my $distver = DBIx::Class->VERSION; + my $sqltver = $class->req_list_for ('deploy')->{'SQL::Translator'} + or die "Hrmm? No sqlt dep?"; my @chunks = ( <<"EOC", @@ -303,10 +305,8 @@ sub _gen_pod { EOC '=head1 NAME', "$class - Optional module dependency specifications (for module authors)", - '=head1 SYNOPSIS (EXPERIMENTAL)', + '=head1 SYNOPSIS', < - Somewhere in your build-file (e.g. L's Makefile.PL): ... @@ -366,6 +366,17 @@ EOD push @chunks, ( '=head1 METHODS', + '=head2 req_group_list', + '=over', + '=item Arguments: $none', + '=item Returns: \%list_of_requirement_groups', + '=back', + < version of -DBIx::Class. See the L for a real-world +DBIx::Class. See the L for a real-world example. EOD @@ -396,10 +407,10 @@ This method would normally be used by DBIx::Class core-module author, to indicate to the user that he needs to install specific modules before he will be able to use a specific feature. -For example if the requirements for C are not available, the -returned string would look like: +For example if some of the requirements for C are not available, +the returned string could look like: - Moose >= 0.98, MooseX::Types >= 0.21, namespace::clean (see $class for details) + SQL::Translator >= $sqltver (see $class for details) The author is expected to prepend the necessary text to this message before returning the actual error seen by the user.