corelist.pm

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PM 代码 · 共 1,218 行 · 第 1/5 页

PM
1,218
字号
package Module::CoreList;use strict;use vars qw/$VERSION %released %patchlevel %version %families/;$VERSION = '2.13';=head1 NAMEModule::CoreList - what modules shipped with versions of perl=head1 SYNOPSIS use Module::CoreList; print $Module::CoreList::version{5.00503}{CPAN}; # prints 1.48 print Module::CoreList->first_release('File::Spec');         # prints 5.00405 print Module::CoreList->first_release_by_date('File::Spec'); # prints 5.005 print Module::CoreList->first_release('File::Spec', 0.82);   # prints 5.006001 print join ', ', Module::CoreList->find_modules(qr/Data/);    # prints 'Data::Dumper' print join ', ', Module::CoreList->find_modules(qr/test::h.*::.*s/i, 5.008008);    # prints 'Test::Harness::Assert, Test::Harness::Straps' print join ", ", @{ $Module::CoreList::families{5.005} };    # prints "5.005, 5.00503, 5.00504" print join " ", @{ $Module::CoreList::patchlevel{5.008001} };    # prints "maint-5.8 21377"=head1 DESCRIPTIONModule::CoreList contains the hash of hashes%Module::CoreList::version, that is keyed on perl version as indicatedin $].  The second level hash is module => version pairs.Note, it is possible for the version of a module to be unspecified,whereby the value is undef, so use C<exists $version{$foo}{$bar}> ifthat's what you're testing for.It also contains %Module::CoreList::released hash, which has ISOformatted versions of the release dates, as gleaned from L<perlhist>.New, in 1.96 is also the %Module::CoreList::families hash, whichclusters known perl releases by their major versions.In 2.01 %Module::CoreList::patchlevel contains the branch and patchlevelcorresponding to the specified perl version in the Perforce repository wherethe perl sources are kept.Starting with 2.10, the special module name C<Unicode> refers to the version ofthe Unicode Character Database bundled with Perl.Since 2.11, Module::CoreList::first_release() returns the first releasein the order of perl version numbers. If you want to get the earliestperl release instead, use Module::CoreList::first_release_by_date().=head1 CAVEATSModule::CoreList currently covers the 5.000, 5.001, 5.002, 5.003_07, 5.004,5.004_05, 5.005, 5.005_03, 5.005_04, 5.6.0, 5.6.1, 5.6.2, 5.7.3, 5.8.0, 5.8.1,5.8.2, 5.8.3, 5.8.4, 5.8.5, 5.8.6, 5.8.7, 5.8.8, 5.9.0, 5.9.1, 5.9.2, 5.9.3,5.9.4, 5.9.5 and 5.10.0 releases of perl.=head1 HISTORYMoved to Changes file.=head1 AUTHORRichard Clamp E<lt>richardc@unixbeard.netE<gt>Currently maintained by the perl 5 porters E<lt>perl5-porters@perl.orgE<gt>.=head1 COPYRIGHTCopyright (C) 2002-2007 Richard Clamp.  All Rights Reserved.This module is free software; you can redistribute it and/or modify itunder the same terms as Perl itself.=head1 SEE ALSOL<corelist>, L<Module::Info>, L<perl>=cutmy $dumpinc = 0;sub import {    my $self = shift;    my $what = shift || '';    if ($what eq 'dumpinc') {        $dumpinc = 1;    }}END {    print "---INC---\n", join "\n" => keys %INC      if $dumpinc;}sub first_release_raw {    my ($discard, $module, $version) = @_;    my @perls = $version        ? grep { exists $version{$_}{ $module } &&                        $version{$_}{ $module } ge $version } keys %version        : grep { exists $version{$_}{ $module }             } keys %version;    return @perls;}sub first_release_by_date {    my @perls = &first_release_raw;    return unless @perls;    return (sort { $released{$a} cmp $released{$b} } @perls)[0];}sub first_release {    my @perls = &first_release_raw;    return unless @perls;    return (sort { $a cmp $b } @perls)[0];}sub find_modules {    my $discard = shift;    my $regex = shift;    my @perls = @_;    @perls = keys %version unless @perls;    my %mods;    foreach (@perls) {        while (my ($k, $v) = each %{$version{$_}}) {            $mods{$k}++ if $k =~ $regex;        }    }    return sort keys %mods}# when things escaped%released = (    5.000    => '1994-10-17',    5.001    => '1995-03-14',    5.002    => '1996-02-96',    5.00307  => '1996-10-10',    5.004    => '1997-05-15',    5.005    => '1998-07-22',    5.00503  => '1999-03-28',    5.00405  => '1999-04-29',    5.006    => '2000-03-22',    5.006001 => '2001-04-08',    5.007003 => '2002-03-05',    5.008    => '2002-07-19',    5.008001 => '2003-09-25',    5.009    => '2003-10-27',    5.008002 => '2003-11-05',    5.006002 => '2003-11-15',    5.008003 => '2004-01-14',    5.00504  => '2004-02-23',    5.009001 => '2004-03-16',    5.008004 => '2004-04-21',    5.008005 => '2004-07-19',    5.008006 => '2004-11-27',    5.009002 => '2005-04-01',    5.008007 => '2005-05-30',    5.009003 => '2006-01-28',    5.008008 => '2006-01-31',    5.009004 => '2006-08-15',    5.009005 => '2007-07-07',    5.010000 => '2007-12-18',   );# perforce branches and patch levels%patchlevel = (    5.005    => [perl => 1647],    5.00503  => ['maint-5.005' => 3198],    5.00405  => ['maint-5.004' => 999],    5.006    => [perl => 5899],    5.006001 => ['maint-5.6' => 9654],    5.006002 => ['maint-5.6' => 21727],    5.007003 => [perl => 15039],    5.008    => [perl => 17637],    5.008001 => ['maint-5.8' => 21377],    5.008002 => ['maint-5.8' => 21670],    5.009    => [perl => 21539],    5.008003 => ['maint-5.8' => 22151],    5.00504  => ['maint-5.005' => 22270],    5.009001 => [perl => 22506],    5.008004 => ['maint-5.8' => 22729],    5.008005 => ['maint-5.8' => 23139],    5.008006 => ['maint-5.8' => 23552],    5.009002 => [perl => 24131],    5.008007 => ['maint-5.8' => 24641],    5.009003 => [perl => 26975],    5.008008 => ['maint-5.8' => 27040],    5.009004 => [perl => 28727],    5.009005 => [perl => 31562],    5.010000 => [perl => 32642],);for my $version ( sort { $a <=> $b } keys %released ) {    my $family = int ($version * 1000) / 1000;    push @{ $families{ $family }} , $version;}%version = (    5.000 => {        'AnyDBM_File'           => undef,  # lib/AnyDBM_File.pm        'AutoLoader'            => undef,  # lib/AutoLoader.pm        'AutoSplit'             => undef,  # lib/AutoSplit.pm        'Benchmark'             => undef,  # lib/Benchmark.pm        'Carp'                  => undef,  # lib/Carp.pm        'Cwd'                   => undef,  # lib/Cwd.pm        'DB_File'               => undef,  # ext/DB_File/DB_File.pm        'DynaLoader'            => undef,  # ext/DynaLoader/DynaLoader.pm        'English'               => undef,  # lib/English.pm        'Env'                   => undef,  # lib/Env.pm        'Exporter'              => undef,  # lib/Exporter.pm        'ExtUtils::MakeMaker'   => undef,  # lib/ExtUtils/MakeMaker.pm        'Fcntl'                 => undef,  # ext/Fcntl/Fcntl.pm        'File::Basename'        => undef,  # lib/File/Basename.pm        'File::CheckTree'       => undef,  # lib/File/CheckTree.pm        'File::Find'            => undef,  # lib/File/Find.pm        'FileHandle'            => undef,  # lib/FileHandle.pm        'GDBM_File'             => undef,  # ext/GDBM_File/GDBM_File.pm        'Getopt::Long'          => undef,  # lib/Getopt/Long.pm        'Getopt::Std'           => undef,  # lib/Getopt/Std.pm        'I18N::Collate'         => undef,  # lib/I18N/Collate.pm        'IPC::Open2'            => undef,  # lib/IPC/Open2.pm        'IPC::Open3'            => undef,  # lib/IPC/Open3.pm        'Math::BigFloat'        => undef,  # lib/Math/BigFloat.pm        'Math::BigInt'          => undef,  # lib/Math/BigInt.pm        'Math::Complex'         => undef,  # lib/Math/Complex.pm        'NDBM_File'             => undef,  # ext/NDBM_File/NDBM_File.pm        'Net::Ping'             => undef,  # lib/Net/Ping.pm        'ODBM_File'             => undef,  # ext/ODBM_File/ODBM_File.pm        'POSIX'                 => undef,  # ext/POSIX/POSIX.pm        'SDBM_File'             => undef,  # ext/SDBM_File/SDBM_File.pm        'Search::Dict'          => undef,  # lib/Search/Dict.pm        'Shell'                 => undef,  # lib/Shell.pm        'Socket'                => undef,  # ext/Socket/Socket.pm

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?