Git Product home page Git Product logo

Comments (18)

exodist avatar exodist commented on July 30, 2024

It is intentionally left out. The documentation mentions that it is required. It was left out of Build.pl completely because Devel::Declare is scary to some. Vanilla Exporter::Declare does not need it, and I don't want anyone to reject it for recommending or requiring it. This was a strategic descision to ensure Exporter::Declare could be installed where I work by not giving anyone the ability to reject it from listing Devel::Declare.

from exporter-declare.

Xiong avatar Xiong commented on July 30, 2024

You may not see this as an issue; I'm not sure I want to argue. I took a guess that Exporter::Declare would work without Devel::Declare provided I avoided -magic; it seems to do so. Few of us get paid for work on CPAN modules; you don't owe me anything. I'm glad you've done something interesting. Let me explain my reasoning and perhaps it will appeal to you.

Your module introduced me to Devel::Declare; it's also interesting. I might be wary of using such stuff in production code but then that might be said of a lot. For projects such as my current (Devel::Toolbox), I'm willing to skate much closer to the edge: My audience consists of developers. However, I don't resolve module dependencies by hand; I leave that up to my command line installer, cpan. Typical bleeding-edge modules trigger such a cascade of dependency installation; I'd be an old man before I read and fully understood all the modules upon which even one depends. -Oh right, I'm already an old man. I guess I'd be dead.

Your counter-issue involves $work, always an explosive, heavily overloaded object. I don't know what stuff you must do to fool $work into believing you will not burn down the office; so I'm not sure what to say. At what exact point does $work become upset?

Exporter::Declare POD mentions three other modules in quick succession: Devel::Declare, Exporter::Declare::Magic, Devel::Declare::Magic. The relationship among these four is unclear. Perhaps you can get away with an explicit statement:

If you want to use Exporter::Declare -magic, which requires Exporter::Declare::Magic;
then you must install Devel::Declare. The latter is not required by Exporter::Declare due to
reasons.

A risk is that another developer may use -magic in his CPAN project but not, in that project directly, Devel::Declare. However he has the latter installed already anyway; so -magic works. He ships his project and it fails smoke. I do not think he ought to have re-required, in his project's Build.PL, all of your dependencies; he's counting on you to name them yourself. You might change your implementation at any time and so long as you keep the API constant, your... OEM vendors... should neither know nor care.

If you list Devel::Declare in its Build.PL's recommends then I'd like to hope that $work would not object; a restrictive $work would demand that installers install only requires. I configure mine to install permanently and automatically not only requires but build_requires and recommends; perhaps many users so choose.

From another viewpoint -- perhaps the viewpoint of $work -- Exporter::Declare is acceptable but Exporter::Declare::Magic is not. So you could release two distinct dists, Exporter-Declare and Exporter-Declare-Magic. The latter would require the former; the former would not even mention the latter. Drop the -magic feature from Exporter::Declare; it is now squeaky clean. Adventurous developers can then use Exporter::Declare::Magic which does not even cost you a keystroke over current usage. I would support this solution; $work can hardly object; all other users should be content, blissfully ignorant, or joyfully delighted -- none upset.

Forgive me if I've gone on too long or presumed too much. I'd like to help.

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

Initially when I wrote Exporter::Declare I was at another employer, and left it out because of their policies. However since then I have found that not listing Devel::Declare has been critical and newer employers, including my current. I think explaining why would be giving too much detail about internals at my current company, so I would rather not share them.

Luckily you are looking for a solution to the problem, not a reason for it. I cannot simply remove -magic, as there are a lot of things which use that. In addition separating out the '-magic' logic would be less than ideal. My next idea was that I can add a friendly message so that if someone tries to use '-magic' it tells them that they need to install Devel::Declare, however looking at the code it would seem I have already done this: https://github.com/exodist/Exporter-Declare/blob/master/lib/Exporter/Declare/Magic.pm More specifically it mentions Devel::Declare::Parser, which does require Devel::Declare.

So as it stands, anyone who uses something that uses Exporter::Declare -magic, but does not have Devel::Declare will get a very unambiguous message telling them to install the module. In addition anyone who uses -magic in their cpan module can add Devel::Declare::Parser to their own build dependencies. If they choose not to then the cpan testing should show exactly what the problem is.

If you want to improve the language of the documentation, to make this even more clear, I would happily accept a patch.

from exporter-declare.

Xiong avatar Xiong commented on July 30, 2024

Solutions interest me; finding fault does not. Causes are only interesting insofar as they drive solutions. When I was younger I thought causes were critical. Now I've seen such tangled messes at the bottom that deep forensics take one further away from solution.

I am idly curious about the taint that attaches to Devel::Declare.

This issue boils down to a philosophical difference. We both agree on the substance of the issue. You believe good documentation is sufficient; I prefer to avoid the unexpected, rather than warn the user of it. There's no resolution and there need not be; I'm satisfied that we've gone as far as useful. I appreciate your active maintenance of your distribution.

Ah, it does not seem that I get a message from you. Here's the result of my attempt to use -magic without Devel::Declare installed:

Can't locate Devel/Declare/Parser.pm in @INC...

I'm not sure a warning from Exporter::Declare would be any better. The lack is clear, the error is raised at compile time, and it did not take long to decide that I could repair it either by installing Devel::Declare or by avoiding -magic. Perhaps I'm making a mountain out of a molehill.

I would not presume to offer a doc patch because I'm not certain of the exact mechanism to be documented. I suggest language similar to that in the blockquote previous: as explicit as possible. If you must avoid listing a prerequisite in Build.PL then please consider listing it in POD in unambiguous terms. Thank you.

from exporter-declare.

schwern avatar schwern commented on July 30, 2024

I have the same problem as Xiong. Exodist::Util does not work out of the box because it uses Exporter::Declare::Magic which does not declare a dependency on Devel::Declare::Parser. The infection is spreading.

Adding in a runtime message is less than ideal (I don't get a message either, just the normal missing module error). There is an expectation that module dependencies will take care of themselves. As a user of a module, I don't want to know that some module layers down that I have no direct contact with needs special manual attention. Worse, what if the next version of Exporter::Declare::Magic decides to use Super::Declare::Parser? Its exposing its internal dependencies to the user.

If Exporter::Declare::Magic brings in unacceptable dependencies or instabilities, the usual solution is to split that part out into its own distribution. Either it works out of the box, or put it in a different box and make THAT box work. Users of -magic can then depend on Exporter::Declare::Magic which will install Devel::Declare::Parser and anything else special it needs. If Exporter::Declare::Magic is not installed, -magic can throw an error.

There was a parallel problem in LWP with https support. Prior to version 6, you had to install a magic combination of crypto modules to enable SSL support. Version 6.00 changed that magic combination and broke a lot of code. The solution was to split LWP::Protocol::https into its own distribution, which clearly declared its dependencies, and then https users could safely declare on LWP and LWP::Protocol::https.

Finally, I'd recommend deprecating the -magic syntax and just have the user write use Exporter::Declare::Magic. Its no less typing. Its a lot clearer what's going on. Its clearer where to look for documentation. Its very clear that its an extra dependency. Automatic dependency checks like dzil can see it.

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

Very well, I will eventually fix this issue by splitting out ::Magic

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

::Magic has been split into its own separate module. -magic will only work with ::Magic installed, and it has a deprecation warning.

from exporter-declare.

tsibley avatar tsibley commented on July 30, 2024

FWIW, t/Magic.t fails in Exporter-Declare 0.107 because nothing declared the Devel::Declare::Parser dep.

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

reopening

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

@tsibley Can you give me more details, such as error messages. Also is this a failure in Exporter::Declare t/magic.t or Exporter::Declare::Magic t/magic.t?

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

I attempted a fix in 6388e7b based on a couple guesses at what the problem may be. Once cpan tester results are published, or when someone can give me a copy of the errors I will know if the fix is correct. (I have not reproduced the problem so far)

from exporter-declare.

tsibley avatar tsibley commented on July 30, 2024

I can reproduce by doing:

$ cpan-uninstall Devel::Declare::Parser
$ cpan-uninstall Exporter::Declare
$ cpanm Exporter::[email protected]

The cpanm build log:

Searching Exporter::Declare (== 0.107) on metacpan ...
--> Working on Exporter::Declare
Fetching http://www.cpan.org/authors/id/E/EX/EXODIST/Exporter-Declare-0.107.tar.gz
-> OK
Unpacking Exporter-Declare-0.107.tar.gz
Entering Exporter-Declare-0.107
Checking configure dependencies from META.json
Checking if you have Module::Build 0.40 ... Yes (0.4003)
Configuring Exporter-Declare-0.107
Running Build.PL
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Exporter-Declare' version '0.107'
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Test::Exception 0.29 ... Yes (0.31)
Checking if you have Test::Simple 0.88 ... Yes (0.98)
Checking if you have Fennec::Lite 0.004 ... Yes (0.004)
Checking if you have Scalar::Util 0 ... Yes (1.25)
Checking if you have aliased 0 ... Yes (0.30)
Checking if you have Meta::Builder 0.003 ... Yes (0.003)
Checking if you have Carp 0 ... Yes (1.26)
Building and testing Exporter-Declare-0.107
Building Exporter-Declare
t/Declare.t ........ ok
t/Export.t ......... ok
t/Generator.t ...... ok
Can't locate Devel/Declare/Parser.pm in @INC (@INC contains: /home/tom/.cpanm/work/1364148321.1
BEGIN failed--compilation aborted at /opt/perlbrew/perls/perl-5.16.2/lib/site_perl/5.16.2/Expor
Compilation failed in require at t/Magic.t line 8.
BEGIN failed--compilation aborted at t/Magic.t line 12.
t/Magic.t .......... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
t/Meta.t ........... ok
t/Meta_From_Old.t .. ok
t/Specs.t .......... ok
t/Sub.t ............ ok
t/Variable.t ....... ok
t/misc.t ........... ok
t/pod.t ............ skipped: set TEST_POD to enable this test
t/reexport.t ....... ok

Test Summary Report
-------------------
t/Magic.t        (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=12, Tests=140,  0 wallclock secs ( 0.06 usr  0.03 sys +  0.41 cusr  0.11 csys =  0.61 CPU
Result: FAIL
Failed 1/12 test programs. 0/140 subtests failed.

from exporter-declare.

tsibley avatar tsibley commented on July 30, 2024

It seems Exporter::Declare <= 0.106 was also installed separately from a previous minor perl version in @inc, and so Exporter::Declare::Magic was picked up from there even after one cpan-uninstall. If I remove all traces and then rerun I get:

Searching Exporter::Declare (== 0.108) on metacpan ...
--> Working on Exporter::Declare
Fetching http://cpan.metacpan.org/authors/id/E/EX/EXODIST/Exporter-Declare-0.108.tar.gz
-> OK
Unpacking Exporter-Declare-0.108.tar.gz
Entering Exporter-Declare-0.108
Checking configure dependencies from META.json
Checking if you have Module::Build 0.40 ... Yes (0.4003)
Configuring Exporter-Declare-0.108
Running Build.PL
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Exporter-Declare' version '0.108'
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Test::Exception 0.29 ... Yes (0.31)
Checking if you have Test::Simple 0.88 ... Yes (0.98)
Checking if you have Fennec::Lite 0.004 ... Yes (0.004)
Checking if you have Scalar::Util 0 ... Yes (1.25)
Checking if you have aliased 0 ... Yes (0.30)
Checking if you have Meta::Builder 0.003 ... Yes (0.003)
Checking if you have Carp 0 ... Yes (1.26)
Building and testing Exporter-Declare-0.108
Building Exporter-Declare
t/Declare.t ........ ok
t/Export.t ......... ok
t/Generator.t ...... ok
Can't locate Exporter/Declare/Magic.pm in @INC (@INC contains: /home/tom/.cpanm/work/1364148954
BEGIN failed--compilation aborted at t/Magic.t line 16.
t/Magic.t .......... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
t/Meta.t ........... ok
t/Meta_From_Old.t .. ok
t/Specs.t .......... ok
t/Sub.t ............ ok
t/Variable.t ....... ok
t/misc.t ........... ok
t/pod.t ............ skipped: set TEST_POD to enable this test
t/reexport.t ....... ok

Test Summary Report
-------------------
t/Magic.t        (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=12, Tests=140,  1 wallclock secs ( 0.07 usr  0.03 sys +  0.40 cusr  0.12 csys =  0.62 CPU
Result: FAIL
Failed 1/12 test programs. 0/140 subtests failed.

which makes sense given https://github.com/exodist/Exporter-Declare/blob/master/t/Magic.t#L8. The same failure occurs with 0.107, the version in which the require Exporter::Declare::Magic above was added to t/Magic.t.

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

That's what I guessed it was. Please try 0.108 and see if it is fixed.
On Mar 24, 2013 11:18 AM, "Thomas Sibley" [email protected] wrote:

It seems Exporter::Declare <= 0.106 was also installed separately from a
previous minor perl version in @inc https://github.com/INC, and so
Exporter::Declare::Magic was picked up from there even after one
cpan-uninstall. If I remove all traces and then rerun I get:

Searching Exporter::Declare (== 0.108) on metacpan ...
--> Working on Exporter::Declare
Fetching http://cpan.metacpan.org/authors/id/E/EX/EXODIST/Exporter-Declare-0.108.tar.gz
-> OK
Unpacking Exporter-Declare-0.108.tar.gz
Entering Exporter-Declare-0.108
Checking configure dependencies from META.json
Checking if you have Module::Build 0.40 ... Yes (0.4003)
Configuring Exporter-Declare-0.108
Running Build.PL
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Exporter-Declare' version '0.108'
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have Test::Exception 0.29 ... Yes (0.31)
Checking if you have Test::Simple 0.88 ... Yes (0.98)
Checking if you have Fennec::Lite 0.004 ... Yes (0.004)
Checking if you have Scalar::Util 0 ... Yes (1.25)
Checking if you have aliased 0 ... Yes (0.30)
Checking if you have Meta::Builder 0.003 ... Yes (0.003)
Checking if you have Carp 0 ... Yes (1.26)
Building and testing Exporter-Declare-0.108
Building Exporter-Declare
t/Declare.t ........ ok
t/Export.t ......... ok
t/Generator.t ...... ok
Can't locate Exporter/Declare/Magic.pm in @inc (@inc contains: /home/tom/.cpanm/work/1364148954
BEGIN failed--compilation aborted at t/Magic.t line 16.
t/Magic.t ..........
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t/Meta.t ........... ok
t/Meta_From_Old.t .. ok
t/Specs.t .......... ok
t/Sub.t ............ ok
t/Variable.t ....... ok
t/misc.t ........... ok
t/pod.t ............ skipped: set TEST_POD to enable this test
t/reexport.t ....... ok

Test Summary Report

t/Magic.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: No plan found in TAP output
Files=12, Tests=140, 1 wallclock secs ( 0.07 usr 0.03 sys + 0.40 cusr 0.12 csys = 0.62 CPU
Result: FAIL
Failed 1/12 test programs. 0/140 subtests failed.

which makes sense given
https://github.com/exodist/Exporter-Declare/blob/master/t/Magic.t#L8. The
same failure occurs with 0.107, the version in which the require
Exporter::Declare::Magic above was added to t/Magic.t.


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-15365269
.

from exporter-declare.

tsibley avatar tsibley commented on July 30, 2024

It doesn't seem like you read what I wrote:

Searching Exporter::Declare (== 0.108) on metacpan ...
--> Working on Exporter::Declare
Fetching http://cpan.metacpan.org/authors/id/E/EX/EXODIST/Exporter-Declare-0.108.tar.gz

and after the test results:

which makes sense given https://github.com/exodist/Exporter-Declare/blob/master/t/Magic.t#L8. The same failure occurs with 0.107, the version in which the require Exporter::Declare::Magic above was added to t/Magic.t.

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

Gah, you are right, I glossed over the version (on my phone, hard to read)
as for the line in the test file, that's debugging I failed to remove, that
require should not be there. I will fix it and re-up in a minute.
On Mar 24, 2013 12:50 PM, "Thomas Sibley" [email protected] wrote:

It doesn't seem like you read what I wrote:

Searching Exporter::Declare (== 0.108) on metacpan ...
--> Working on Exporter::Declare
Fetching http://cpan.metacpan.org/authors/id/E/EX/EXODIST/Exporter-Declare-0.108.tar.gz

and after the test results:

which makes sense given
https://github.com/exodist/Exporter-Declare/blob/master/t/Magic.t#L8. The
same failure occurs with 0.107, the version in which the require
Exporter::Declare::Magic above was added to t/Magic.t.


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-15367039
.

from exporter-declare.

tsibley avatar tsibley commented on July 30, 2024

Great, thanks!

from exporter-declare.

exodist avatar exodist commented on July 30, 2024

0.109 uploaded to cpan, I used your steps to reproduce the error, and then fix it.

from exporter-declare.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.