pause
pause copied to clipboard
Secondary packages in a file do not get the right VERSION in 02packages.details.txt
I'm providing one example but from what I can tell, there are more.
zcat /root/.cpanpkgr/cache/02packages.details.txt.gz |grep UI::ContainerWidget
3:18 PM
Curses::UI::ContainerWidget 1.12 M/MD/MDXI/Curses-UI-0.9609.tar.gz
but, when I look at the file Curses/UI/Widget.pm, I see:
package Curses::UI::Widget;
use strict;
use Carp qw(confess);
use Term::ReadKey;
use Curses;
use Curses::UI::Common;
require Exporter;
use vars qw(
$VERSION
@ISA
@EXPORT
);
$VERSION = '1.12';
...
package Curses::UI::ContainerWidget;
# Not special at all. This class is especially used as a flag for
# container based widgets, so that we can detect these using
# $object->isa('Curses::UI::ContainerWidget').
use Curses::UI::Container;
use Curses::UI::Widget;
use vars qw(
@ISA
$VERSION
);
$VERSION = '1.10';
At a glance, it looks like the version at the top of the file is being applied to all packages found in the file?
PAUSE only ever tries to find the first version number in a file. ExtUtils::MakeMaker has the same behavior. Parse::PMFile as well.
Are you saying this is intentional? Or the status quo?
Secondary packages should not be in the PAUSE index because they cannot be declared separately. Therefore there is no reason to have a separate $VERSION for them. They should be declared like this so they are not indexed:
package # hide from PAUSE
Foo::Bar;
I would guess you meant "they cannot be required separately"
yes, indeed :)
How does the fact that you cannot directly require a secondary package imply that your code cannot need a particular version of that package?
If you attempted to declare a dependency on a secondary package like this, even if it was in the PAUSE index, installers wouldn't be able to find the current installed version. Even if listed in provides metadata, that metadata is not installed by CPAN.pm, and can't be used to determine the installed versions of modules.
Restating my original concern:
The issue I'm reporting on is the fact that 02packages.details.txt lists Curses::UI::ContainerWidget 1.12. I could go 2 ways with this and am ok with either outcome.
-
Secondary packages in a pm file (especially if it doesn't correspond to the file name) should not be listed in 02packages.details.txt This means I don't have to do indexing or worry about it in my code. I am generating RPM/DEBs and I do actually advertise secondary modules (for good or for bad).
-
Secondary packages should be listed in which case, I would prefer that the VERSION listed for the package be what was declared in the package.
Any packages declared and not hidden from PAUSE need to be indexed and assigned permissions accordingly. So they will be listed, the only issue is the version. It's weird, but as mentioned it's not practically of any use to have a differing version anyway.
This is a duplicate of #170, which was raised in 2015 by @kentfredric.
Close as dupe.