Németh Péter
Németh Péter

Reputation: 151

Specify perl script to run on an earlier version of perl

I have some old production computer which has Perl 5.0 (updated version 1998). I developed a script on my office computer with Activestate Perl 5.24.1

When i tried to run on the older version (installed on Windows XP) it drops several warnings, etc can not know about USE Warnings;, or three parameter open function.

The our keyword cannot be used with use strict;

our %Config = (
        'SourcePath' => "",
        'TargetPath' => "",
        'Station'    => "",
        'Product'    => "",
        'LogLevel'   => 0
    );

When i tried to print a string with a hash variable in, it drops a warning too. The code is:

print $fhw qq/  <FACTORY NAME="FLEX_ZALA" TESTER="$Config{'Station'}" FIXTURE="" USER="" LINE="" SHIFT="" \/>\n/;

The Station variable is not known for it.

I cannot develop on a production machine, but cannot install this old version on my office computer too.

How can i force to run my script with perl 5.24.1 in compatibily mode 5.0?

I using a windows 7 X64 PC for office.

Thanks.

UPD1: The XP Perl version is:

Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\grprog1>perl -v

This is perl, version 5.003_07

Copyright 1987-1996, Larry Wall

    + suidperl security patch
    Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
            All rights reserved.
    Developed by ActiveWare Internet Corp., http://www.ActiveWare.com

Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998

Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5.0 source kit.

UPD2:

C:\Documents and Settings\grprog1>perl -V Summary of my perl5 (patchlevel 1) configuration:   Platform:
    osname=MSWin32, osver=3.51, archname=i386-win32
    uname=''
    hint=recommended   Compiler:
    cc='cl', optimize=''
    cppflags=''
    ccflags =''
    ldflags =''
    stdchar='char', d_stdstdio=, usevfork=false
    voidflags=15, castflags=0, d_casti32=, d_castneg=
    intsize=4, alignbytes=4, usemymalloc=n, randbits=15   Libraries:
    so=dll
    libpth=
    libs=
    libc=   Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=pll, d_dlsymun=
    cccdlflags='', ccdlflags='', lddlflags=''


Characteristics of this binary (from libperl):   Built under MSWin32   Compiled at Mar 13 1998 09:44:44   @INC:
    C:\Teradyne\GRNavigate\228x\lib\perl
    ..\lib\i386-win32
    ..\lib
    .

Upvotes: 1

Views: 1934

Answers (2)

Kjetil S.
Kjetil S.

Reputation: 3787

If you absolutely must, no way around it, run ancient perl, your scripts cannot use more modern stuff.

Check out perlbrew to have more than one version of perl on your development/test box so you can test your code on several versions of perl with one command.

And perhaps also http://perldoc.perl.org/perl.html to see the docs of older perls. It goes back only to 5.8.8 (~2005), but better than using docs for 5.24 in your situation.

Upvotes: 0

Sinan &#220;n&#252;r
Sinan &#220;n&#252;r

Reputation: 118156

If I understand you correctly, you have Computer A which has perl 5.003_7. Therefore, copying that distribution from Computer A to Computer B where you want to do development is the most straightforward answer.

You say the testers also have this version of Perl. Therefore, your company must have bought either a site license or some specific number of licenses from ActiveState. You should investigate that first.

If you are stuck, contact ActiveState for support. They may provide you one for a fee.

Your company, however, faces the problem of having operations depend on ancient, no longer supported software to run programs which probably have problems of their own. It would be a good idea to move into this century.

Upvotes: 2

Related Questions