2

我正在为我的同事和我开发一堆 Perl 脚本。为了简化分发,Perl 本身驻留在网络路径上,并使用此标头直接从那里使用:

@rem = '--*-Perl-*--
@echo off
\\network\path\to\Perl\bin\perl.exe -x -S %0 %*
goto EndOfPerl
@rem ';
#!perl
#line 8
#####################################################################

这工作得很好(现在仍然可以!),但一位同事需要一个独立版本,所以我们将 Perl 的完整网络安装复制到本地硬盘。将标头更改为使用本地位置后,我们会收到以下消息:

Can't locate Tk.pm in @INC (@INC contains: C:/tools/Perl/5.16.1/lib .) at Test.cmd line 30

现在我一直认为@INC 被编译成Perl。至少,它不应该通过简单地将 Perl 复制到另一个位置来改变。

本地启动时 Perl -V 输出略有不同。

这是我从网络开始时得到的:

Summary of my perl5 (revision 5 version 16 subversion 1) configuration:
  Platform:
    osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='12.00.8168', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
    lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
    -libpath:"C:\Perl\lib\CORE"  -machine:x86'
    libpth=\lib
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib
    winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl516.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf  -libpath:"C:\Perl\lib\CORE"  -machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
                        PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC
                        USE_ITHREADS USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_SITECUSTOMIZE
  Locally applied patches:
        ActivePerl Build 1601 [296175]
  Built under MSWin32
  Compiled at Aug 30 2012 20:08:55
  @INC:
    //network/path/to/Perl/site/lib
    //network/path/to/Perl/Perl/lib
    .

这是从本地驱动器执行时的输出:

<snip>
Compiled at Aug 30 2012 20:08:55
  %ENV:
    PERL_DIR="C:\tools\Perl\5.16.1"
  @INC:
    C:/tools/Perl/5.16.1/lib
    .

site/lib 部分不见了!任何想法,任何人?

4

0 回答 0