Subject: | Feature request: is_core() function |
Having heard about this module, I expected to find a function something like:
is_core($module_name);
which would return true if the specified module is core for the currently running version of
perl. It would take an optional second argument, which is a version of perl:
is_core($module_name, $version);
Here's the first pass at is_core, which I wrote for my first use of Module::CoreList:
sub is_core
{
my $module = shift;
my $version = @_ > 0 ? shift : $^V;
return 0 unless defined(my $first_release = Module::CoreList::first_release($module));
return 0 unless $version >= $first_release;
return 1 if !defined(my $final_release = Module::CoreList::removed_from($module));
return $version <= $final_release;
}
I don't know whether you can do those sorts of comparisons with versions,
but I'm not specifying a version in my current usage :-)