Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dist-Zilla CPAN distribution.

Report information
The Basics
Id: 64988
Status: resolved
Priority: 0/
Queue: Dist-Zilla

People
Owner: Nobody in particular
Requestors: lucs [...] pobox.com
Cc: cjm [...] cpan.org
AdminCc:

Bug Information
Severity: Normal
Broken in: 4.200000
Fixed in: (no value)



Subject: Main module not located when it's under a "gathered" directory.
Download (untitled) / with headers
text/plain 2.5k
There is a problem with guessing/finding the main module when it happens to be under a "gathered" directory. The most immediate consequence is that the main abstract cannot be located. The following setup shows how the problem appears (I unfortunately haven't been able to figure out how to build a committable test for it): $ ls -lR .: total 8 -rw-r--r-- 1 lucs lucs 100 2011-01-21 10:34 dist.ini drwxr-xr-x 3 lucs lucs 4096 2011-01-21 10:27 src ./src: total 4 drwxr-xr-x 2 lucs lucs 4096 2011-01-21 10:43 lib ./src/lib: total 4 -rw-r--r-- 1 lucs lucs 25 2011-01-21 10:14 Foo.pm $ cat dist.ini name = Foo version = 0.001 license = Perl_5 copyright_holder = A.U.Thor [GatherDir] root = src $ cat src/lib/Foo.pm #ABSTRACT: The abstract $ dzil build [DZ] beginning to build Foo [DZ] guessing dist's main_module is lib/Foo.pm [DZ] extracting distribution abstract from lib/Foo.pm file 'lib/Foo.pm' does not exist at /opt/apps/perl/lib/site_perl/5.12.2/Dist/Zilla/Util.pm line 54 The following patch fixes it, but it's not clear to me whether it could have unintended side effects: --- lib/Dist/Zilla.pm | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index 8bc9b15..2dd0134 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -122,7 +122,7 @@ has abstract => ( die "no abstract given and no main_module found; make sure your main module is in ./lib\n"; } - my $filename = $self->main_module->name; + my $filename = $self->main_module->_original_name; $self->log("extracting distribution abstract from $filename"); my $abstract = Dist::Zilla::Util->abstract_from_file($filename); @@ -205,7 +205,7 @@ has main_module => ( push @errorlines,"Cannot continue without a main_module"; $self->log_fatal( join qq{\n}, @errorlines ); } - $self->log("${guessing}dist's main_module is " . $file->name); + $self->log("${guessing}dist's main_module is " . $file->_original_name); return $file; }, -- After applying the patch: $ dzil build [DZ] beginning to build Foo [DZ] guessing dist's main_module is src/lib/Foo.pm [DZ] extracting distribution abstract from src/lib/Foo.pm [DZ] writing Foo in Foo-0.001 [DZ] writing archive to Foo-0.001.tar.gz $ ls -lR Foo-0.001 Foo-0.001: total 4 drwxr-xr-x 2 lucs lucs 4096 2011-01-21 10:45 lib Foo-0.001/lib: total 4 -rw-r--r-- 1 lucs lucs 25 2011-01-21 10:45 Foo.pm
Download (untitled) / with headers
text/plain 185b
Wouldn't a better solution to this problem be to change abstract_from_file to take a Dist::Zilla::Role::File object? Then it could get the file contents through the standard interface.
Download (untitled) / with headers
text/plain 256b
Can you confirm that this is still a problem? since this was filed, the main_module code was altered, and it might have fixed this; I can test when I get back to this bug, but if somebody wants to re-try and let me know it's already fixed, super -- rjbs
Download (untitled) / with headers
text/plain 194b
On Thu, Jun 2, 2011 8:50:48 PM, RJBS wrote: Show quoted text
> Can you confirm that this is still a problem?
No, the bug is gone in dzil version 4.200006. I didn't look to see which version actually fixed it.
Thanks, Christopher, you are a great help as always. -- rjbs
CC: cjm [...] cpan.org
Subject: Re: [rt.cpan.org #64988] Main module not located when it's under a "gathered" directory.
Date: Fri, 03 Jun 2011 08:15:22 -0400
To: Ricardo Signes via RT <bug-Dist-Zilla [...] rt.cpan.org>
From: Luc St-Louis <lucs [...] pobox.com>
Download (untitled) / with headers
text/plain 618b
On Thu, Jun 02, 2011 at 09:50:49PM -0400, Ricardo Signes via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=64988 > > > Can you confirm that this is still a problem? > > since this was filed, the main_module code was altered, and it might > have fixed this; I can test when I get back to this bug, but if somebody > wants to re-try and let me know it's already fixed, super
It indeed appears to be fixed, as Christopher mentioned. Looking at the git history, this happened at commit 9bd67ed, "get abstract from file object instead of disk file", by David Golden, and is present in 4.200001. Thanks.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.