in reply to Core Modules

Would Module::CoreList help?

Replies are listed 'Best First'.
Re^2: Core Modules
by Herkum (Parson) on Jun 20, 2008 at 19:38 UTC

    The documentation is a little unclear so tell me if I am reading it correctly. It looks like it has an entry for every module that was included with Perl by version, correct? So if I do,

    use Module::CoreList; if (not Module::CoreList->first_release_by_date('Foo::Bar')) { print "Foo::bar is not a part of core\n"; }

    That should return what I want?

    Update: Adding the code to my program, I still had these modules show up that I am sure are a part of Core.

    1. strict
    2. vars
    3. constant
    4. Exporter
    5. overload

    OK, they are in the core list I just have to change my check, I believe to find them, because they have no version number.

      The corelist utility script, which is part of the Module::CoreList download, can be used as an example of using the module to give you the type of list you are looking for.

      For example, to find all core modules for Perl version 5.8.8:

      % corelist -v 5.8.8 The following modules were in perl v5.008008 CORE AnyDBM_File 1.00 Attribute::Handlers 0.78_02 AutoLoader 5.60 AutoSplit 1.04 B 1.09_01 B::Asmdata 1.01 B::Assembler 0.07 B::Bblock 1.02_01 ...

      I think you should check using the version of Perl that's running.

      if ( exists $Module::CoreList::version{$]}{'Foo::Bar'} ) { print "Foo::Bar is core in this version of Perl.\n"; }

      This way you don't false positive on something that's core in a version other than the one you have. I haven't used Module::CoreList, however, so I'm not sure.

        You pointed me at the right thing and I am kinda brain dead today and was doing some stupid things.

        The way I understand it, it tells you specifically when a module is added in each version, the first_release() tells you what version that module was added into core. As long as I get a number back from it, I know it is a part of Core.

        That was huge help and I did not know about that module, so overall it has been a good day! :)