⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib.pm

📁 MSYS在windows下模拟了一个类unix的终端
💻 PM
字号:
package lib;use 5.005_64;use Config;my $archname = defined($Config{'archname'}) ? $Config{'archname'} : '';my $ver = defined($Config{'version'}) ? $Config{'version'} : '';my @inc_version_list = defined($Config{'inc_version_list'}) ?   reverse split / /, $Config{'inc_version_list'} : ();our @ORIG_INC = @INC;	# take a handy copy of 'original' valueour $VERSION = '0.5564';sub import {    shift;    my %names;    foreach (reverse @_) {	if ($_ eq '') {	    require Carp;	    Carp::carp("Empty compile time value given to use lib");	}	if (-e && ! -d _) {	    require Carp;	    Carp::carp("Parameter to use lib must be directory, not file");	}	unshift(@INC, $_);        # Add any previous version directories we found at configure time        foreach my $incver (@inc_version_list)        {            unshift(@INC, "$_/$incver") if -d "$_/$incver";        }	# Put a corresponding archlib directory infront of $_ if it	# looks like $_ has an archlib directory below it.	unshift(@INC, "$_/$archname") if -d "$_/$archname/auto";	unshift(@INC, "$_/$ver") if -d "$_/$ver";	unshift(@INC, "$_/$ver/$archname") if -d "$_/$ver/$archname";    }    # remove trailing duplicates    @INC = grep { ++$names{$_} == 1 } @INC;    return;}sub unimport {    shift;    my %names;    foreach (@_) {	++$names{$_};	++$names{"$_/$archname"} if -d "$_/$archname/auto";	++$names{"$_/$ver"} if -d "$_/$ver";	++$names{"$_/$ver/$archname"} if -d "$_/$ver/$archname";    }    # Remove ALL instances of each named directory.    @INC = grep { !exists $names{$_} } @INC;    return;}1;__END__=head1 NAMElib - manipulate @INC at compile time=head1 SYNOPSIS    use lib LIST;    no lib LIST;=head1 DESCRIPTIONThis is a small simple module which simplifies the manipulation of @INCat compile time.It is typically used to add extra directories to perl's search path sothat later C<use> or C<require> statements will find modules which arenot located on perl's default search path.=head2 Adding directories to @INCThe parameters to C<use lib> are added to the start of the perl searchpath. Saying    use lib LIST;is I<almost> the same as saying    BEGIN { unshift(@INC, LIST) }For each directory in LIST (called $dir here) the lib module alsochecks to see if a directory called $dir/$archname/auto exists.If so the $dir/$archname directory is assumed to be a correspondingarchitecture specific directory and is added to @INC in front of $dir.To avoid memory leaks, all trailing duplicate entries in @INC areremoved.=head2 Deleting directories from @INCYou should normally only add directories to @INC.  If you need todelete directories from @INC take care to only delete those which youadded yourself or which you are certain are not needed by other modulesin your script.  Other modules may have added directories which theyneed for correct operation.The C<no lib> statement deletes all instances of each named directoryfrom @INC.For each directory in LIST (called $dir here) the lib module alsochecks to see if a directory called $dir/$archname/auto exists.If so the $dir/$archname directory is assumed to be a correspondingarchitecture specific directory and is also deleted from @INC.=head2 Restoring original @INCWhen the lib module is first loaded it records the current value of @INCin an array C<@lib::ORIG_INC>. To restore @INC to that value youcan say    @INC = @lib::ORIG_INC;=head1 SEE ALSOFindBin - optional module which deals with paths relative to the source file.=head1 AUTHORTim Bunce, 2nd June 1995.=cut

⌨️ 快捷键说明

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