From: Peter Rabbitson Date: Wed, 1 Apr 2015 20:52:41 +0000 (+0200) Subject: Fix incorrect optdep output introduced in 34d2deae / 31c31b8d X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34f354c33a21fdf20bee90696ef3c061823ce0ff;p=dbsrgits%2FDBIx-Class-Historic.git Fix incorrect optdep output introduced in 34d2deae / 31c31b8d Too many thinkos for a simple feature like this. When given "foo" cpanm actually tries to find '"foo"' on CPAN, and nothing works. The original thinking was that the > in ~>= needs escaping when copy/pasted by a user, so the ""-enclosing seemed like a valid approach. Of course this does not work at all when the output is piped into cpanm directly: perl -Ilib -MDBIx::Class::Optional::Dependencies=-list_missing,deploy | cpanm Moreover, all of the above is *utterly unnecessary*, as Foo~>=2 is entirely equivalent to Foo~2, which requires no escaping (thus quoting) whatsoever. Hopefully this is the end of the embarrassing flailing on this feature :( --- diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index 7e69eea..e56ffd8 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -808,7 +808,7 @@ sub modreq_missing_for { or return ''; join ' ', map - { $reqs->{modreqs}{$_} ? qq("$_~>=$reqs->{modreqs}{$_}") : $_ } + { $reqs->{modreqs}{$_} ? "$_~$reqs->{modreqs}{$_}" : $_ } sort { lc($a) cmp lc($b) } keys %$modreq_errors ; } @@ -1143,7 +1143,7 @@ sub _list_physically_missing_modules { } join ' ', map - { $modreqs->{$_} ? qq("$_~>=$modreqs->{$_}") : $_ } + { $modreqs->{$_} ? "$_~$modreqs->{$_}" : $_ } sort { lc($a) cmp lc($b) } @definitely_missing ; } @@ -1495,7 +1495,7 @@ For example if some of the requirements for C are not available, the returned string could look like: EOC - push @chunks, qq{ "SQL::Translator~>=$sqltver" (see $class documentation for details)}; + push @chunks, qq{ "SQL::Translator~$sqltver" (see $class documentation for details)}; push @chunks, <<'EOC'; The author is expected to prepend the necessary text to this message before @@ -1520,7 +1520,7 @@ For instance if some of the requirements for C are not available, the returned string could look like: EOC - push @chunks, qq{ "SQL::Translator~>=$sqltver"}; + push @chunks, qq{ "SQL::Translator~$sqltver"}; push @chunks, <<'EOC'; diff --git a/xt/extra/internals/optional_deps.t b/xt/extra/internals/optional_deps.t index c33fd23..c0ffb74 100644 --- a/xt/extra/internals/optional_deps.t +++ b/xt/extra/internals/optional_deps.t @@ -65,7 +65,7 @@ is_deeply ( DBIx::Class::Optional::Dependencies->modreq_missing_for ($_), qr/ \A - " SQL::Translator \~ \>\= [\d\.]+ " + SQL::Translator \~ [\d\.]+ \z /x, 'expected modreq missing string contents', @@ -75,7 +75,7 @@ is_deeply ( DBIx::Class::Optional::Dependencies->req_missing_for ($_), qr/ \A - " SQL::Translator \~ \>\= [\d\.]+ " + SQL::Translator \~ [\d\.]+ \Q (see DBIx::Class::Optional::Dependencies documentation for details)\E \z /x, @@ -169,13 +169,13 @@ is_deeply ( is( DBIx::Class::Optional::Dependencies->req_missing_for([qw( rdbms_pg test_rdbms_pg )]), - '"DBD::Pg~>=2.009002" as well as the following group(s) of environment variables: DBICTEST_PG_DSN/..._USER/..._PASS', + 'DBD::Pg~2.009002 as well as the following group(s) of environment variables: DBICTEST_PG_DSN/..._USER/..._PASS', 'optional dependencies for testing Postgres without envvar' ); is( DBIx::Class::Optional::Dependencies->req_missing_for([shuffle qw( test_rdbms_mysql test_rdbms_pg )]), - 'DBD::mysql "DBD::Pg~>=2.009002" as well as the following group(s) of environment variables: DBICTEST_MYSQL_DSN/..._USER/..._PASS and DBICTEST_PG_DSN/..._USER/..._PASS', + 'DBD::mysql DBD::Pg~2.009002 as well as the following group(s) of environment variables: DBICTEST_MYSQL_DSN/..._USER/..._PASS and DBICTEST_PG_DSN/..._USER/..._PASS', 'optional dependencies for testing Postgres+MySQL without envvars' ); @@ -188,7 +188,7 @@ is_deeply ( is( DBIx::Class::Optional::Dependencies->req_missing_for([shuffle qw( rdbms_pg test_rdbms_pg )]), - '"DBD::Pg~>=2.009002"', + 'DBD::Pg~2.009002', 'optional dependencies error text for testing Postgres matches with evvar', ); @@ -215,7 +215,7 @@ is_deeply ( is( DBIx::Class::Optional::Dependencies->req_missing_for($mysql_icdt), - '"DateTime~>=0.55" DateTime::Format::MySQL DBD::mysql as well as the following group(s) of environment variables: DBICTEST_MYSQL_DSN/..._USER/..._PASS', + 'DateTime~0.55 DateTime::Format::MySQL DBD::mysql as well as the following group(s) of environment variables: DBICTEST_MYSQL_DSN/..._USER/..._PASS', 'missing optional dependencies for testing ICDT MySQL without envvars' ); @@ -225,13 +225,13 @@ is_deeply ( my $msaccess_mssql_icdt = [ shuffle qw( test_rdbms_msaccess_odbc test_rdbms_mssql_odbc icdt ) ]; is_deeply( DBIx::Class::Optional::Dependencies->req_missing_for($msaccess_mssql_icdt), - 'Data::GUID "DateTime~>=0.55" "DateTime::Format::Strptime~>=1.2" DBD::ODBC as well as the following group(s) of environment variables: DBICTEST_MSACCESS_ODBC_DSN/..._USER/..._PASS', + 'Data::GUID DateTime~0.55 DateTime::Format::Strptime~1.2 DBD::ODBC as well as the following group(s) of environment variables: DBICTEST_MSACCESS_ODBC_DSN/..._USER/..._PASS', 'Correct req_missing_for on multi-level converging include', ); is_deeply( DBIx::Class::Optional::Dependencies->modreq_missing_for($msaccess_mssql_icdt), - 'Data::GUID "DateTime~>=0.55" "DateTime::Format::Strptime~>=1.2" DBD::ODBC', + 'Data::GUID DateTime~0.55 DateTime::Format::Strptime~1.2 DBD::ODBC', 'Correct modreq_missing_for on multi-level converging include', );