On Tue, Mar 05, 2002 at 01:21:36PM -0600, Ken Williams wrote:
> 
> On Tuesday, March 5, 2002, at 08:58 AM, Richard Clamp wrote:
> >Say if I were to figure out what versions modules were shipped with
> >each release of perl were[0], so that I could write some code to
> >figure out what were CPAN dependencies for a given module, where would
> >I put it?
> 
> Somewhere very public!

Well yes, my plan was to drop it somewhere on CPAN, my question is
more where to leave it, so that someone else might know where to look
for it.

>                         I don't know of any place where one can find 
> this information easily right now, 

Tell me about it, even with the unholy power of Module::Info some of
the data was a little tricky to extract.

>                                    much less a programmatic interface to 
> it.  It would be most welcome if you were to do this.

What I have so far is here,
http://unixbeard.net/~richardc/lab/Module-CoreList/ - I'll put a few
example scripts in with it when a second tuit shakes itself out.
They're mostly the scripts I hacked up the other week deploying a site
for $dayjob, and as yet aren't terribly general, but they did remind
me of this itch.

> >I'm currently looking at $Module::Core::List{'5.6.1'}; but it doesn't
> >seem quite right.
> 
> Yeah, that doesn't seem like a good interface.  I'd want some methods 
> like this, or similar:

I think I still want to expose the data, I really don't expect the
structure to change, we're just associating packages and their
versions given a release of perl, it's much more book keeping than
programming at this point.

Most of your suggested methods are probably worth including as
convenience routines, though they're fairly easy to implement even if
they don't get added to the interface.

>  my $perl5_6 = Module::CoreVersion->release('5.6');

my $perl5_6 = $Module::CoreList::version{'5.6.1'};

>  do ... if $perl5_6->has('File::Spec');

do ... if exists $perl5_6->{'File::Spec'};

>  do ... if $perl5_6->has(File::Spec => 2.1);  # at least version 2.1

do ... if $perl5_6->{'File::Spec'} >= 2.1;

>  do ... if $perl5_6->version('File::Spec') eq '2.1';

do ... if $perl5_6->{'File::Spec'} eq '2.1';

>  print $perl5_6->as_string;  # For easy visual reference

Umm, what would that print?  The names of all 217 modules shipped with
5.6.1, that there are 217, or that there was a 5.6 release?

>  my $perl_version = Module::CoreVersion->earliest('File::Spec');

my $v = \%Module::CoreList::version;
my ($perl_version) = sort { $a <=> $b } grep { exists $v->{'File::Spec'} } keys %$v;

>  my $perl_version = Module::CoreVersion->earliest(File::Spec => 2.1);

my $v = \%Module::CoreList::version;
my ($perl_version) = sort { $a <=> $b } grep { $v->{'File::Spec'} >= 2.1 } keys %$v;

> That's a start, anyway.  What do you think of 'Module::CoreVersion'?  
> Maybe it should be plural?

It has odd connotations for me, as if Module::CoreVersions would
refuse to let me use anything but the versions of modules shipped with
perl, rather than any of that newfangled CPAN nonsense :)

I have the hardest time naming stuff though.

-- 
Richard Clamp <[EMAIL PROTECTED]>

Reply via email to