Name Date Size #Lines LOC

..29-Oct-2022-

Cross/H15-May-2024-4,5953,883

Porting/H15-May-2024-48,61435,235

amigaos4/H15-May-2024-2,1071,657

cpan/H15-May-2024-919,820689,681

cygwin/H15-May-2024-552432

dist/H15-May-2024-203,799147,548

ext/H08-May-2022-100,22869,011

h2pl/H08-May-2022-578491

haiku/H08-May-2022-222137

hints/H15-May-2024-12,0267,093

lib/H15-May-2024-817,214732,925

os2/H15-May-2024-17,73212,402

plan9/H15-May-2024-10,5859,350

pod/H15-May-2024-185,230131,294

qnx/H15-Feb-2023-7030

regen/H15-May-2024-22,21614,437

t/H15-May-2024-161,630127,118

utils/H15-May-2024-7,5555,803

vms/H15-May-2024-16,99212,587

vos/H08-May-2022-243191

win32/H15-May-2024-34,11227,833

.dir-locals.elH A D08-May-2022208 64

.editorconfigH A D15-Feb-2023169 119

.lgtm.ymlH A D08-May-2022347 1615

.metaconf-exclusions.txtH A D08-May-20221.3 KiB2826

AUTHORSH A D15-May-202472.1 KiB1,4671,466

ArtisticH A D08-May-20226.2 KiB13299

CODE_OF_CONDUCT.mdH A D15-Feb-2023973 2116

ChangesH A D08-May-20223 KiB7055

ConfigureH A D15-May-2024591.2 KiB25,95724,045

CopyingH A D08-May-202212.3 KiB252200

EXTERN.hH A D15-May-20241.5 KiB5937

INSTALLH A D15-May-2024111.7 KiB2,8682,129

INTERN.hH A D15-May-20241.3 KiB5232

MANIFESTH A D15-May-2024390.3 KiB7,0647,063

META.jsonH A D15-May-20243.2 KiB125124

META.ymlH A D15-May-20242.5 KiB111110

Makefile.SHH A D15-May-202451.6 KiB1,7691,241

Makefile.bsd-wrapperH A D03-Sep-20231.3 KiB5735

Makefile.bsd-wrapper1H A D15-May-202438.4 KiB856837

Makefile.microH A D15-May-20245.8 KiB212142

PACKAGINGH A D15-May-20241.7 KiB5335

Policy_sh.SHH A D08-May-20227.9 KiB259124

READMEH A D15-May-20245.3 KiB12390

README.aixH A D15-May-202420 KiB519390

README.amigaH A D15-May-20245.6 KiB226135

README.androidH A D15-May-20248 KiB221153

README.bs2000H A D15-May-20247.8 KiB246170

README.cnH A D15-May-20244.7 KiB15793

README.cygwinH A D15-May-202425.5 KiB745548

README.freebsdH A D15-May-20241.6 KiB4430

README.haikuH A D15-May-20241.5 KiB6739

README.hpuxH A D15-May-202429.9 KiB712552

README.hurdH A D15-May-20242 KiB5839

README.irixH A D15-May-20244.3 KiB14292

README.jpH A D15-May-20248.2 KiB212133

README.koH A D15-May-202411.9 KiB337201

README.linuxH A D15-May-20242 KiB5436

README.macosxH A D15-May-202411.9 KiB278204

README.microH A D08-May-20221.8 KiB5035

README.openbsdH A D15-May-20241.2 KiB3422

README.os2H A D15-May-202491.2 KiB2,7731,921

README.os390H A D15-May-202413.9 KiB420292

README.os400H A D15-May-20244.7 KiB12688

README.plan9H A D15-May-20245 KiB149105

README.qnxH A D15-May-20246.5 KiB207142

README.riscosH A D15-May-20241.5 KiB7042

README.solarisH A D15-May-202429.2 KiB716533

README.synologyH A D15-May-202410.1 KiB351229

README.tru64H A D15-May-20248.3 KiB193144

README.twH A D15-May-20244.4 KiB16193

README.vmsH A D15-May-202422.5 KiB598428

README.vosH A D15-May-20243.8 KiB12482

README.win32H A D15-May-202432 KiB801586

SECURITY.mdH A D15-Feb-20232 KiB4333

TestInit.pmH A D08-May-20224 KiB14980

XSUB.hH A D15-May-202423.7 KiB680386

asan_ignoreH A D08-May-2022868 2923

autodoc.plH A D15-May-202480.3 KiB2,0721,423

av.cH A D15-May-202435.2 KiB1,265741

av.hH A D15-Feb-20236.8 KiB21935

builtin.cH A D15-May-202414.5 KiB569402

caretx.cH A D15-May-20244.1 KiB13981

cflags.SHH A D15-May-202414.6 KiB520352

charclass_invlists.hH A D15-May-20244.3 MiB436,087430,014

class.cH A D15-May-202430.6 KiB1,065729

config.overH A D03-Sep-20231.8 KiB7358

config_h.SHH A D15-May-2024168.1 KiB5,4214,347

configpmH A D15-May-202438.1 KiB1,333767

configure.comH A D15-May-2024213.3 KiB7,5027,473

configure.gnuH A D08-May-20222.5 KiB137107

cop.hH A D15-May-202457.2 KiB1,453722

cv.hH A D15-May-202414.3 KiB372194

deb.cH A D15-May-20249.8 KiB371247

doio.cH A D15-May-2024105.4 KiB3,4532,858

doop.cH A D15-May-202437.2 KiB1,258897

dosish.hH A D15-May-20243.6 KiB12048

dquote.cH A D15-May-202418.3 KiB567361

dump.cH A D15-May-2024114.2 KiB3,4412,651

ebcdic_tables.hH A D15-May-202448.8 KiB799609

embed.fncH A D15-May-2024192.4 KiB6,1906,137

embed.hH A D15-May-2024143.5 KiB2,1682,109

embedvar.hH A D15-May-202423.9 KiB372348

fakesdio.hH A D08-May-20223.1 KiB128102

feature.hH A D15-May-202415 KiB455387

form.hH A D08-May-20221.4 KiB2818

gen_syscall_emulator.plH A D03-Sep-20238.1 KiB361266

generate_uudmap.cH A D15-Feb-20235.5 KiB200129

git_version.hH A D08-May-2022279 81

globals.cH A D15-Feb-20231.4 KiB457

globvar.symH A D15-May-20241.7 KiB10098

gv.cH A D15-May-2024142.4 KiB4,3562,935

gv.hH A D15-May-202411.7 KiB313194

handy.hH A D15-May-2024141.9 KiB3,1191,215

hv.cH A D15-May-2024134.7 KiB4,1802,619

hv.hH A D15-May-202427.6 KiB712374

hv_func.hH A D15-May-20247.7 KiB190132

hv_macro.hH A D15-May-20243.1 KiB8656

inline.hH A D15-May-2024111.9 KiB3,7661,711

install_lib.plH A D15-Feb-20235.2 KiB218173

installhtmlH A D15-Feb-202317.4 KiB588390

installmanH A D15-Feb-20235.9 KiB189142

installperlH A D15-Feb-202326.6 KiB810601

intrpvar.hH A D15-May-202437.9 KiB1,110437

invlist_inline.hH A D15-May-202411.2 KiB376215

iperlsys.hH A D15-May-202462.5 KiB1,4231,245

keywords.cH A D15-May-202492.4 KiB3,5632,913

keywords.hH A D15-May-20246.6 KiB284264

l1_char_class_tab.hH A D15-May-2024118.1 KiB797780

locale.cH A D15-May-2024269.5 KiB7,3333,997

make_ext.plH A D15-Feb-202326.3 KiB779532

make_patchnum.plH A D15-May-20247.5 KiB235166

makedef.plH A D15-May-202429.5 KiB1,2371,029

makedepend.SHH A D15-Feb-20234.5 KiB173139

makedepend_file.SHH A D15-Feb-20236.3 KiB177126

malloc.cH A D15-May-202480.7 KiB2,4121,645

malloc_ctl.hH A D08-May-20221.5 KiB6346

mathoms.cH A D15-May-202420.6 KiB980495

metaconfig.SHH A D15-Feb-20231.2 KiB331

metaconfig.hH A D15-May-2024705 190

mg.cH A D15-May-2024111.1 KiB4,0383,068

mg.hH A D15-Feb-20233.6 KiB9061

mg_names.incH A D15-May-20242.3 KiB5956

mg_raw.hH A D15-May-20244.7 KiB10190

mg_vtable.hH A D15-May-202410.3 KiB260219

miniperlmain.cH A D15-May-20245.1 KiB16569

mkppportH A D15-May-20244.3 KiB188102

mkppport.lstH A D15-Feb-2023369 2119

mro_core.cH A D15-May-202449.7 KiB1,459877

myconfig.SHH A D15-Feb-20232.6 KiB10090

mydtrace.hH A D08-May-20221.7 KiB5528

nostdio.hH A D15-Feb-20233.3 KiB135106

numeric.cH A D15-May-202462.9 KiB1,9991,164

op.cH A D15-May-2024512.7 KiB15,71310,516

op.hH A D15-May-202440.9 KiB1,179630

op_reg_common.hH A D15-May-20245.9 KiB15877

opcode.hH A D15-May-202495.8 KiB3,5143,424

opnames.hH A D15-May-20249.2 KiB468438

overload.hH A D15-May-20243.2 KiB9979

overload.incH A D15-May-20243.6 KiB181176

packsizetables.incH A D15-May-20245.9 KiB223219

pad.cH A D15-May-202497.4 KiB2,9861,834

pad.hH A D15-May-202419.6 KiB575249

parser.hH A D15-Feb-20236.9 KiB166117

patchlevel.hH A D15-May-20246.4 KiB17933

peep.cH A D15-May-2024154 KiB4,2282,388

perl.cH A D15-May-2024167.6 KiB5,4843,903

perl.hH A D15-May-2024320.4 KiB9,1865,626

perl_inc_macro.hH A D15-May-20245.9 KiB183119

perl_langinfo.hH A D08-May-20222.8 KiB191178

perl_siphash.hH A D15-Feb-20235.1 KiB128105

perlapi.hH A D15-May-2024635 233

perldtrace.dH A D08-May-2022491 218

perlio.cH A D15-May-2024141.9 KiB5,2484,268

perlio.hH A D15-May-20249.5 KiB351245

perlio.symH A D08-May-2022446 2927

perliol.hH A D15-Feb-202313.3 KiB284225

perlsdio.hH A D08-May-2022527 223

perlstatic.hH A D15-May-2024894 347

perlvars.hH A D15-May-202416.8 KiB403102

perly.actH A D15-May-202451.5 KiB2,3541,760

perly.cH A D15-May-202418.7 KiB616383

perly.hH A D15-May-20245.7 KiB242179

perly.tabH A D15-May-202489.1 KiB1,3341,309

perly.yH A D15-May-202453.3 KiB1,6891,406

pp.cH A D15-May-2024221.8 KiB7,5705,954

pp.hH A D15-May-202430 KiB726348

pp_ctl.cH A D15-May-2024217.4 KiB6,6724,868

pp_hot.cH A D15-May-2024203 KiB5,9413,921

pp_pack.cH A D15-May-2024107.3 KiB3,1792,722

pp_proto.hH A D15-May-202420.4 KiB325316

pp_sort.cH A D15-May-202443.1 KiB1,348857

pp_sys.cH A D15-May-2024159.1 KiB5,9774,907

proto.hH A D15-May-2024327.9 KiB10,5558,419

reentr.cH A D15-May-202419.9 KiB681503

reentr.hH A D15-May-202485.2 KiB1,7011,416

regcharclass.hH A D15-May-2024270.3 KiB3,8593,093

regcomp.cH A D15-May-2024648.8 KiB16,26010,146

regcomp.hH A D15-May-202468 KiB1,564680

regcomp.symH A D15-May-202418.4 KiB348287

regcomp_debug.cH A D15-May-202460.3 KiB1,6711,260

regcomp_internal.hH A D15-May-202460.7 KiB1,262675

regcomp_invlist.cH A D15-May-202456 KiB1,541779

regcomp_study.cH A D15-May-2024166.9 KiB3,8222,506

regcomp_trie.cH A D15-May-202471.2 KiB1,7181,074

regen.plH A D15-May-2024914 3621

regen_perly.plH A D15-Feb-20239.7 KiB359216

regexec.cH A D15-May-2024471.7 KiB12,3838,432

regexp.hH A D15-May-202443.7 KiB1,045603

reginline.hH A D15-May-20241.5 KiB6542

regnodes.hH A D15-May-2024127 KiB2,9812,411

run.cH A D08-May-20221.4 KiB5315

runtests.SHH A D15-Feb-20232.5 KiB10569

sbox32_hash.hH A D15-May-202454.4 KiB1,7371,702

scope.cH A D15-May-202456.4 KiB1,9911,319

scope.hH A D15-May-202412.2 KiB322185

scope_types.hH A D15-May-20245.1 KiB152121

shlib_versionH A D15-May-202417 32

sv.cH A D15-May-2024565.9 KiB17,54411,230

sv.hH A D15-May-2024105.6 KiB2,7171,255

sv_inline.hH A D15-May-202427.7 KiB1,003645

syscall_emulator.cH A D15-May-202439.9 KiB1,4211,268

syscall_emulator.hH A D03-Sep-202333 21

taint.cH A D15-May-20246.1 KiB213140

thread.hH A D15-May-202419.5 KiB550419

time64.cH A D15-May-202416.7 KiB584345

time64.hH A D15-Feb-2023900 4932

time64_config.hH A D15-Feb-20232 KiB8814

toke.cH A D15-May-2024461.9 KiB13,8749,873

uconfig.hH A D15-May-2024164.2 KiB5,388383

uconfig.shH A D15-May-202418.5 KiB939937

uconfig64.shH A D15-May-202418.5 KiB939937

uni_keywords.hH A D15-May-2024557.4 KiB7,7667,677

unicode_constants.hH A D15-May-202456.4 KiB246141

universal.cH A D15-May-202437.5 KiB1,419983

unixish.hH A D15-May-20245.5 KiB18059

utf8.cH A D15-May-2024172.4 KiB4,5872,321

utf8.hH A D15-May-202460.1 KiB1,324411

utfebcdic.hH A D15-May-202411.5 KiB20913

util.cH A D15-May-2024194 KiB6,7074,446

util.hH A D15-May-202410.5 KiB286128

utils.lstH A D08-May-2022392 2322

vutil.cH A D15-Feb-202327.5 KiB1,145812

vutil.hH A D15-Feb-20234 KiB11588

vxs.incH A D15-Feb-202310.5 KiB450404

warnings.hH A D15-May-202411.7 KiB363142

write_buildcustomize.plH A D15-Feb-20233.3 KiB12175

zaphod32_hash.hH A D15-May-20249.5 KiB293238

README

1Perl is Copyright (C) 1993 - 2023 by Larry Wall and others.
2
3All rights reserved.
4
5# ABOUT PERL
6
7Perl is a general-purpose programming language originally developed for
8text manipulation and now used for a wide range of tasks including
9system administration, web development, network programming, GUI
10development, and more.
11
12The language is intended to be practical (easy to use, efficient,
13complete) rather than beautiful (tiny, elegant, minimal).  Its major
14features are that it's easy to use, supports both procedural and
15object-oriented (OO) programming, has powerful built-in support for text
16processing, and has one of the world's most impressive collections of
17third-party modules.
18
19For an introduction to the language's features, see pod/perlintro.pod.
20
21For a discussion of the important changes in this release, see
22pod/perldelta.pod.
23
24There are also many Perl books available, covering a wide variety of topics,
25from various publishers.  See pod/perlbook.pod for more information.
26
27
28# INSTALLATION
29
30If you're using a relatively modern operating system and want to
31install this version of Perl locally, run the following commands:
32
33    ./Configure -des -Dprefix=$HOME/localperl
34    make test
35    make install
36
37This will configure and compile perl for your platform, run the regression
38tests, and install perl in a subdirectory "localperl" of your home directory.
39
40If you run into any trouble whatsoever or you need to install a customized
41version of Perl, you should read the detailed instructions in the "INSTALL"
42file that came with this distribution.  Additionally, there are a number of
43"README" files with hints and tips about building and using Perl on a wide
44variety of platforms, some more common than others.
45
46Once you have Perl installed, a wealth of documentation is available to you
47through the 'perldoc' tool.  To get started, run this command:
48
49    perldoc perl
50
51
52# IF YOU RUN INTO TROUBLE
53
54Perl is a large and complex system that's used for everything from
55knitting to rocket science.  If you run into trouble, it's quite
56likely that someone else has already solved the problem you're
57facing. Once you've exhausted the documentation, please report bugs to us
58at the GitHub issue tracker at https://github.com/Perl/perl5/issues
59
60While it was current when we made it available, Perl is constantly evolving
61and there may be a more recent version that fixes bugs you've run into or
62adds new features that you might find useful.
63
64You can always find the latest version of perl on a CPAN (Comprehensive Perl
65Archive Network) site near you at https://www.cpan.org/src/
66
67If you want to submit a simple patch to the perl source, see the "SUPER
68QUICK PATCH GUIDE" in pod/perlhack.pod.
69
70Just a personal note:  I want you to know that I create nice things like this
71because it pleases the Author of my story.  If this bothers you, then your
72notion of Authorship needs some revision.  But you can use perl anyway. :-)
73
74The author.
75
76
77# LICENSING
78
79This program is free software; you can redistribute it and/or modify
80it under the terms of either:
81
82a.  the GNU General Public License as published by the Free
83    Software Foundation; either version 1, or (at your option) any
84    later version, or
85
86b.  the "Artistic License" which comes with this Kit.
87
88This program is distributed in the hope that it will be useful,
89but WITHOUT ANY WARRANTY; without even the implied warranty of
90MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either
91the GNU General Public License or the Artistic License for more details.
92
93You should have received a copy of the Artistic License with this
94Kit, in the file named "Artistic".  If not, I'll be glad to provide one.
95
96You should also have received a copy of the GNU General Public License
97along with this program in the file named "Copying". If not, write to the
98Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
99Boston, MA 02110-1301, USA or visit their web page on the internet at
100https://www.gnu.org/copyleft/gpl.html.
101
102For those of you that choose to use the GNU General Public License,
103my interpretation of the GNU General Public License is that no Perl
104script falls under the terms of the GPL unless you explicitly put
105said script under the terms of the GPL yourself.  Furthermore, any
106object code linked with perl does not automatically fall under the
107terms of the GPL, provided such object code only adds definitions
108of subroutines and variables, and does not otherwise impair the
109resulting interpreter from executing any standard Perl script.  I
110consider linking in C subroutines in this manner to be the moral
111equivalent of defining subroutines in the Perl language itself.  You
112may sell such an object file as proprietary provided that you provide
113or offer to provide the Perl source, as specified by the GNU General
114Public License.  (This is merely an alternate way of specifying input
115to the program.)  You may also sell a binary produced by the dumping of
116a running Perl script that belongs to you, provided that you provide or
117offer to provide the Perl source as specified by the GPL.  (The
118fact that a Perl interpreter and your code are in the same binary file
119is, in this case, a form of mere aggregation.)  This is my interpretation
120of the GPL.  If you still have concerns or difficulties understanding
121my intent, feel free to contact me.  Of course, the Artistic License
122spells all this out for your protection, so you may prefer to use that.
123

README.aix

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlaix - Perl version 5 on IBM AIX (UNIX) systems
10
11=head1 DESCRIPTION
12
13This document describes various features of IBM's UNIX operating
14system AIX that will affect how Perl version 5 (hereafter just Perl)
15is compiled and/or runs.
16
17=head2 Compiling Perl 5 on AIX
18
19For information on compilers on older versions of AIX, see L</Compiling
20Perl 5 on older AIX versions up to 4.3.3>.
21
22When compiling Perl, you must use an ANSI C compiler. AIX does not ship
23an ANSI compliant C compiler with AIX by default, but binary builds of
24gcc for AIX are widely available. A version of gcc is also included in
25the AIX Toolbox which is shipped with AIX.
26
27=head2 Supported Compilers
28
29Currently all versions of IBM's "xlc", "xlc_r", "cc", "cc_r" or
30"vac" ANSI/C compiler will work for building Perl if that compiler
31works on your system.
32
33If you plan to link Perl to any module that requires thread-support,
34like DBD::Oracle, it is better to use the _r version of the compiler.
35This will not build a threaded Perl, but a thread-enabled Perl. See
36also L</Threaded Perl> later on.
37
38As of writing (2010-09) only the I<IBM XL C for AIX> or I<IBM XL C/C++
39for AIX> compiler is supported by IBM on AIX 5L/6.1/7.1.
40
41The following compiler versions are currently supported by IBM:
42
43    IBM XL C and IBM XL C/C++ V8, V9, V10, V11
44
45The XL C for AIX is integrated in the XL C/C++ for AIX compiler and
46therefore also supported.
47
48If you choose XL C/C++ V9 you need APAR IZ35785 installed
49otherwise the integrated SDBM_File do not compile correctly due
50to an optimization bug. You can circumvent this problem by
51adding -qipa to the optimization flags (-Doptimize='-O -qipa').
52The PTF for APAR IZ35785 which solves this problem is available
53from IBM (April 2009 PTF for XL C/C++ Enterprise Edition for AIX, V9.0).
54
55If you choose XL C/C++ V11 you need the April 2010 PTF (or newer)
56installed otherwise you will not get a working Perl version.
57
58Perl can be compiled with either IBM's ANSI C compiler or with gcc.
59The former is recommended, as not only it can compile Perl with no
60difficulty, but also can take advantage of features listed later
61that require the use of IBM compiler-specific command-line flags.
62
63If you decide to use gcc, make sure your installation is recent and
64complete, and be sure to read the Perl INSTALL file for more gcc-specific
65details. Please report any hoops you had to jump through to the
66development team.
67
68=head2 Incompatibility with AIX Toolbox lib gdbm
69
70If the AIX Toolbox version of lib gdbm < 1.8.3-5 is installed on your
71system then Perl will not work. This library contains the header files
72/opt/freeware/include/gdbm/dbm.h|ndbm.h which conflict with the AIX
73system versions. The lib gdbm will be automatically removed from the
74wanted libraries if the presence of one of these two header files is
75detected. If you want to build Perl with GDBM support then please install
76at least gdbm-devel-1.8.3-5 (or higher).
77
78=head2 Perl 5 was successfully compiled and tested on:
79
80 Perl   | AIX Level           | Compiler Level          | w th | w/o th
81 -------+---------------------+-------------------------+------+-------
82 5.12.2 |5.1 TL9 32 bit       | XL C/C++ V7             | OK   | OK
83 5.12.2 |5.1 TL9 64 bit       | XL C/C++ V7             | OK   | OK
84 5.12.2 |5.2 TL10 SP8 32 bit  | XL C/C++ V8             | OK   | OK
85 5.12.2 |5.2 TL10 SP8 32 bit  | gcc 3.2.2               | OK   | OK
86 5.12.2 |5.2 TL10 SP8 64 bit  | XL C/C++ V8             | OK   | OK
87 5.12.2 |5.3 TL8 SP8 32 bit   | XL C/C++ V9 + IZ35785   | OK   | OK
88 5.12.2 |5.3 TL8 SP8 32 bit   | gcc 4.2.4               | OK   | OK
89 5.12.2 |5.3 TL8 SP8 64 bit   | XL C/C++ V9 + IZ35785   | OK   | OK
90 5.12.2 |5.3 TL10 SP3 32 bit  | XL C/C++ V11 + Apr 2010 | OK   | OK
91 5.12.2 |5.3 TL10 SP3 64 bit  | XL C/C++ V11 + Apr 2010 | OK   | OK
92 5.12.2 |6.1 TL1 SP7 32 bit   | XL C/C++ V10            | OK   | OK
93 5.12.2 |6.1 TL1 SP7 64 bit   | XL C/C++ V10            | OK   | OK
94 5.13   |7.1 TL0 SP1 32 bit   | XL C/C++ V11 + Jul 2010 | OK   | OK
95 5.13   |7.1 TL0 SP1 64 bit   | XL C/C++ V11 + Jul 2010 | OK   | OK
96
97 w th   = with thread support
98 w/o th = without thread support
99 OK     = tested
100
101Successfully tested means that all "make test" runs finish with a
102result of 100% OK. All tests were conducted with -Duseshrplib set.
103
104All tests were conducted on the oldest supported AIX technology level
105with the latest support package applied. If the tested AIX version is
106out of support (AIX 4.3.3, 5.1, 5.2) then the last available support
107level was used.
108
109=head2 Building Dynamic Extensions on AIX
110
111Starting from Perl 5.7.2 (and consequently 5.8.x / 5.10.x / 5.12.x)
112and AIX 4.3 or newer Perl uses the AIX native dynamic loading interface
113in the so called runtime linking mode instead of the emulated interface
114that was used in Perl releases 5.6.1 and earlier or, for AIX releases
1154.2 and earlier. This change does break backward compatibility with
116compiled modules from earlier Perl releases. The change was made to make
117Perl more compliant with other applications like Apache/mod_perl which are
118using the AIX native interface. This change also enables the use of
119C++ code with static constructors and destructors in Perl extensions,
120which was not possible using the emulated interface.
121
122It is highly recommended to use the new interface.
123
124=head2 Using Large Files with Perl
125
126Should yield no problems.
127
128=head2 Threaded Perl
129
130Should yield no problems with AIX 5.1 / 5.2 / 5.3 / 6.1 / 7.1.
131
132IBM uses the AIX system Perl (V5.6.0 on AIX 5.1 and V5.8.2 on
133AIX 5.2 / 5.3 and 6.1; V5.8.8 on AIX 5.3 TL11 and AIX 6.1 TL4; V5.10.1
134on AIX 7.1) for some AIX system scripts. If you switch the links in
135/usr/bin from the AIX system Perl (/usr/opt/perl5) to the newly build
136Perl then you get the same features as with the IBM AIX system Perl if
137the threaded options are used.
138
139The threaded Perl build works also on AIX 5.1 but the IBM Perl
140build (Perl v5.6.0) is not threaded on AIX 5.1.
141
142Perl 5.12 an newer is not compatible with the IBM fileset perl.libext.
143
144=head2 64-bit Perl
145
146If your AIX system is installed with 64-bit support, you can expect 64-bit
147configurations to work. If you want to use 64-bit Perl on AIX 6.1
148you need an APAR for a libc.a bug which affects (n)dbm_XXX functions.
149The APAR number for this problem is IZ39077.
150
151If you need more memory (larger data segment) for your Perl programs you
152can set:
153
154    /etc/security/limits
155    default:                    (or your user)
156        data = -1               (default is 262144 * 512 byte)
157
158With the default setting the size is limited to 128MB.
159The -1 removes this limit. If the "make test" fails please change
160your /etc/security/limits as stated above.
161
162=head2 Long doubles
163
164IBM calls its implementation of long doubles 128-bit, but it is not
165the IEEE 128-bit ("quadruple precision") which would give 116 bit of
166mantissa (nor it is implemented in hardware), instead it's a special
167software implementation called "double-double", which gives 106 bits
168of mantissa.
169
170There seem to be various problems in this long double implementation.
171If Configure detects this brokenness, it will disable the long double support.
172This can be overridden with explicit C<-Duselongdouble> (or C<-Dusemorebits>,
173which enables both long doubles and 64 bit integers).  If you decide to
174enable long doubles, for most of the broken things Perl has implemented
175workarounds, but the handling of the special values infinity and NaN
176remains badly broken: for example infinity plus zero results in NaN.
177
178=head2 Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (threaded/32-bit)
179
180With the following options you get a threaded Perl version which
181passes all make tests in threaded 32-bit mode, which is the default
182configuration for the Perl builds that AIX ships with.
183
184    rm config.sh
185    ./Configure \
186    -d \
187    -Dcc=cc_r \
188    -Duseshrplib \
189    -Dusethreads \
190    -Dprefix=/usr/opt/perl5_32
191
192The -Dprefix option will install Perl in a directory parallel to the
193IBM AIX system Perl installation.
194
195=head2 Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (32-bit)
196
197With the following options you get a Perl version which passes
198all make tests in 32-bit mode.
199
200    rm config.sh
201    ./Configure \
202    -d \
203    -Dcc=cc_r \
204    -Duseshrplib \
205    -Dprefix=/usr/opt/perl5_32
206
207The -Dprefix option will install Perl in a directory parallel to the
208IBM AIX system Perl installation.
209
210=head2 Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (threaded/64-bit)
211
212With the following options you get a threaded Perl version which
213passes all make tests in 64-bit mode.
214
215 export OBJECT_MODE=64 / setenv OBJECT_MODE 64 (depending on your shell)
216
217 rm config.sh
218 ./Configure \
219 -d \
220 -Dcc=cc_r \
221 -Duseshrplib \
222 -Dusethreads \
223 -Duse64bitall \
224 -Dprefix=/usr/opt/perl5_64
225
226=head2 Recommended Options AIX 5.1/5.2/5.3/6.1 and 7.1 (64-bit)
227
228With the following options you get a Perl version which passes all
229make tests in 64-bit mode.
230
231 export OBJECT_MODE=64 / setenv OBJECT_MODE 64 (depending on your shell)
232
233 rm config.sh
234 ./Configure \
235 -d \
236 -Dcc=cc_r \
237 -Duseshrplib \
238 -Duse64bitall \
239 -Dprefix=/usr/opt/perl5_64
240
241The -Dprefix option will install Perl in a directory parallel to the
242IBM AIX system Perl installation.
243
244If you choose gcc to compile 64-bit Perl then you need to add the
245following option:
246
247    -Dcc='gcc -maix64'
248
249
250=head2 Compiling Perl 5 on AIX 7.1.0
251
252A regression in AIX 7 causes a failure in make test in Time::Piece during
253daylight savings time.  APAR IV16514 provides the fix for this.  A quick
254test to see if it's required, assuming it is currently daylight savings
255in Eastern Time, would be to run C< TZ=EST5 date +%Z >.  This will come
256back with C<EST> normally, but nothing if you have the problem.
257
258
259=head2 Compiling Perl 5 on older AIX versions up to 4.3.3
260
261Due to the fact that AIX 4.3.3 reached end-of-service in December 31,
2622003 this information is provided as is. The Perl versions prior to
263Perl 5.8.9 could be compiled on AIX up to 4.3.3 with the following
264settings (your mileage may vary):
265
266When compiling Perl, you must use an ANSI C compiler. AIX does not ship
267an ANSI compliant C-compiler with AIX by default, but binary builds of
268gcc for AIX are widely available.
269
270At the moment of writing, AIX supports two different native C compilers,
271for which you have to pay: B<xlC> and B<vac>. If you decide to use either
272of these two (which is quite a lot easier than using gcc), be sure to
273upgrade to the latest available patch level. Currently:
274
275    xlC.C     3.1.4.10 or 3.6.6.0 or 4.0.2.2 or 5.0.2.9 or 6.0.0.3
276    vac.C     4.4.0.3  or 5.0.2.6 or 6.0.0.1
277
278note that xlC has the OS version in the name as of version 4.0.2.0, so
279you will find xlC.C for AIX-5.0 as package
280
281    xlC.aix50.rte   5.0.2.0 or 6.0.0.3
282
283subversions are not the same "latest" on all OS versions. For example,
284the latest xlC-5 on aix41 is 5.0.2.9, while on aix43, it is 5.0.2.7.
285
286Perl can be compiled with either IBM's ANSI C compiler or with gcc.
287The former is recommended, as not only can it compile Perl with no
288difficulty, but also can take advantage of features listed later that
289require the use of IBM compiler-specific command-line flags.
290
291The IBM's compiler patch levels 5.0.0.0 and 5.0.1.0 have compiler
292optimization bugs that affect compiling perl.c and regcomp.c,
293respectively.  If Perl's configuration detects those compiler patch
294levels, optimization is turned off for the said source code files.
295Upgrading to at least 5.0.2.0 is recommended.
296
297If you decide to use gcc, make sure your installation is recent and
298complete, and be sure to read the Perl INSTALL file for more gcc-specific
299details. Please report any hoops you had to jump through to the development
300team.
301
302=head2 OS level
303
304Before installing the patches to the IBM C-compiler you need to know the
305level of patching for the Operating System. IBM's command 'oslevel' will
306show the base, but is not always complete (in this example oslevel shows
3074.3.NULL, whereas the system might run most of 4.3.THREE):
308
309    # oslevel
310    4.3.0.0
311    # lslpp -l | grep 'bos.rte '
312    bos.rte           4.3.3.75  COMMITTED  Base Operating System Runtime
313    bos.rte            4.3.2.0  COMMITTED  Base Operating System Runtime
314    #
315
316The same might happen to AIX 5.1 or other OS levels. As a side note, Perl
317cannot be built without bos.adt.syscalls and bos.adt.libm installed
318
319    # lslpp -l | egrep "syscalls|libm"
320    bos.adt.libm      5.1.0.25  COMMITTED  Base Application Development
321    bos.adt.syscalls  5.1.0.36  COMMITTED  System Calls Application
322    #
323
324=head2 Building Dynamic Extensions on AIX E<lt> 5L
325
326AIX supports dynamically loadable objects as well as shared libraries.
327Shared libraries by convention end with the suffix .a, which is a bit
328misleading, as an archive can contain static as well as dynamic members.
329For Perl dynamically loaded objects we use the .so suffix also used on
330many other platforms.
331
332Note that starting from Perl 5.7.2 (and consequently 5.8.0) and AIX 4.3
333or newer Perl uses the AIX native dynamic loading interface in the so
334called runtime linking mode instead of the emulated interface that was
335used in Perl releases 5.6.1 and earlier or, for AIX releases 4.2 and
336earlier.  This change does break backward compatibility with compiled
337modules from earlier Perl releases.  The change was made to make Perl
338more compliant with other applications like Apache/mod_perl which are
339using the AIX native interface. This change also enables the use of C++
340code with static constructors and destructors in Perl extensions, which
341was not possible using the emulated interface.
342
343=head2 The IBM ANSI C Compiler
344
345All defaults for Configure can be used.
346
347If you've chosen to use vac 4, be sure to run 4.4.0.3. Older versions
348will turn up nasty later on. For vac 5 be sure to run at least 5.0.1.0,
349but vac 5.0.2.6 or up is highly recommended. Note that since IBM has
350removed vac 5.0.2.1 through 5.0.2.5 from the software depot, these
351versions should be considered obsolete.
352
353Here's a brief lead of how to upgrade the compiler to the latest
354level.  Of course this is subject to changes.  You can only upgrade
355versions from ftp-available updates if the first three digit groups
356are the same (in where you can skip intermediate unlike the patches
357in the developer snapshots of Perl), or to one version up where the
358"base" is available.  In other words, the AIX compiler patches are
359cumulative.
360
361 vac.C.4.4.0.1 => vac.C.4.4.0.3  is OK     (vac.C.4.4.0.2 not needed)
362 xlC.C.3.1.3.3 => xlC.C.3.1.4.10 is NOT OK (xlC.C.3.1.4.0 is not
363                                                              available)
364
365 # ftp ftp.software.ibm.com
366 Connected to service.boulder.ibm.com.
367 : welcome message ...
368 Name (ftp.software.ibm.com:merijn): anonymous
369 331 Guest login ok, send your complete e-mail address as password.
370 Password:
371 ... accepted login stuff
372 ftp> cd /aix/fixes/v4/
373 ftp> dir other other.ll
374 output to local-file: other.ll? y
375 200 PORT command successful.
376 150 Opening ASCII mode data connection for /bin/ls.
377 226 Transfer complete.
378 ftp> dir xlc xlc.ll
379 output to local-file: xlc.ll? y
380 200 PORT command successful.
381 150 Opening ASCII mode data connection for /bin/ls.
382 226 Transfer complete.
383 ftp> bye
384 ... goodbye messages
385 # ls -l *.ll
386 -rw-rw-rw-   1 merijn   system    1169432 Nov  2 17:29 other.ll
387 -rw-rw-rw-   1 merijn   system      29170 Nov  2 17:29 xlc.ll
388
389On AIX 4.2 using xlC, we continue:
390
391 # lslpp -l | fgrep 'xlC.C '
392   xlC.C                     3.1.4.9  COMMITTED  C for AIX Compiler
393   xlC.C                     3.1.4.0  COMMITTED  C for AIX Compiler
394 # grep 'xlC.C.3.1.4.*.bff' xlc.ll
395 -rw-r--r--   1 45776101 1       6286336 Jul 22 1996  xlC.C.3.1.4.1.bff
396 -rw-rw-r--   1 45776101 1       6173696 Aug 24 1998  xlC.C.3.1.4.10.bff
397 -rw-r--r--   1 45776101 1       6319104 Aug 14 1996  xlC.C.3.1.4.2.bff
398 -rw-r--r--   1 45776101 1       6316032 Oct 21 1996  xlC.C.3.1.4.3.bff
399 -rw-r--r--   1 45776101 1       6315008 Dec 20 1996  xlC.C.3.1.4.4.bff
400 -rw-rw-r--   1 45776101 1       6178816 Mar 28 1997  xlC.C.3.1.4.5.bff
401 -rw-rw-r--   1 45776101 1       6188032 May 22 1997  xlC.C.3.1.4.6.bff
402 -rw-rw-r--   1 45776101 1       6191104 Sep  5 1997  xlC.C.3.1.4.7.bff
403 -rw-rw-r--   1 45776101 1       6185984 Jan 13 1998  xlC.C.3.1.4.8.bff
404 -rw-rw-r--   1 45776101 1       6169600 May 27 1998  xlC.C.3.1.4.9.bff
405 # wget ftp://ftp.software.ibm.com/aix/fixes/v4/xlc/xlC.C.3.1.4.10.bff
406 #
407
408On AIX 4.3 using vac, we continue:
409
410 # lslpp -l | grep 'vac.C '
411  vac.C                      5.0.2.2  COMMITTED  C for AIX Compiler
412  vac.C                      5.0.2.0  COMMITTED  C for AIX Compiler
413 # grep 'vac.C.5.0.2.*.bff' other.ll
414 -rw-rw-r--   1 45776101 1       13592576 Apr 16 2001  vac.C.5.0.2.0.bff
415 -rw-rw-r--   1 45776101 1       14133248 Apr  9 2002  vac.C.5.0.2.3.bff
416 -rw-rw-r--   1 45776101 1       14173184 May 20 2002  vac.C.5.0.2.4.bff
417 -rw-rw-r--   1 45776101 1       14192640 Nov 22 2002  vac.C.5.0.2.6.bff
418 # wget ftp://ftp.software.ibm.com/aix/fixes/v4/other/vac.C.5.0.2.6.bff
419 #
420
421Likewise on all other OS levels. Then execute the following command, and
422fill in its choices
423
424 # smit install_update
425  -> Install and Update from LATEST Available Software
426  * INPUT device / directory for software [ vac.C.5.0.2.6.bff    ]
427  [ OK ]
428  [ OK ]
429
430Follow the messages ... and you're done.
431
432If you like a more web-like approach, a good start point can be
433L<http://www14.software.ibm.com/webapp/download/downloadaz.jsp> and click
434"C for AIX", and follow the instructions.
435
436=head2 The usenm option
437
438If linking miniperl
439
440 cc -o miniperl ... miniperlmain.o opmini.o perl.o ... -lm -lc ...
441
442causes error like this
443
444 ld: 0711-317 ERROR: Undefined symbol: .aintl
445 ld: 0711-317 ERROR: Undefined symbol: .copysignl
446 ld: 0711-317 ERROR: Undefined symbol: .syscall
447 ld: 0711-317 ERROR: Undefined symbol: .eaccess
448 ld: 0711-317 ERROR: Undefined symbol: .setresuid
449 ld: 0711-317 ERROR: Undefined symbol: .setresgid
450 ld: 0711-317 ERROR: Undefined symbol: .setproctitle
451 ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
452                                                            information.
453
454you could retry with
455
456 make realclean
457 rm config.sh
458 ./Configure -Dusenm ...
459
460which makes Configure to use the C<nm> tool when scanning for library
461symbols, which usually is not done in AIX.
462
463Related to this, you probably should not use the C<-r> option of
464Configure in AIX, because that affects of how the C<nm> tool is used.
465
466=head2 Using GNU's gcc for building Perl
467
468Using gcc-3.x (tested with 3.0.4, 3.1, and 3.2) now works out of the box,
469as do recent gcc-2.9 builds available directly from IBM as part of their
470Linux compatibility packages, available here:
471
472  http://www.ibm.com/servers/aix/products/aixos/linux/
473
474=head2 Using Large Files with Perl E<lt> 5L
475
476Should yield no problems.
477
478=head2 Threaded Perl E<lt> 5L
479
480Threads seem to work OK, though at the moment not all tests pass when
481threads are used in combination with 64-bit configurations.
482
483You may get a warning when doing a threaded build:
484
485  "pp_sys.c", line 4640.39: 1506-280 (W) Function argument assignment
486  between types "unsigned char*" and "const void*" is not allowed.
487
488The exact line number may vary, but if the warning (W) comes from a line
489line this
490
491  hent = PerlSock_gethostbyaddr(addr, (Netdb_hlen_t) addrlen, addrtype);
492
493in the "pp_ghostent" function, you may ignore it safely.  The warning
494is caused by the reentrant variant of gethostbyaddr() having a slightly
495different prototype than its non-reentrant variant, but the difference
496is not really significant here.
497
498=head2 64-bit Perl E<lt> 5L
499
500If your AIX is installed with 64-bit support, you can expect 64-bit
501configurations to work. In combination with threads some tests might
502still fail.
503
504=head2 AIX 4.2 and extensions using C++ with statics
505
506In AIX 4.2 Perl extensions that use C++ functions that use statics
507may have problems in that the statics are not getting initialized.
508In newer AIX releases this has been solved by linking Perl with
509the libC_r library, but unfortunately in AIX 4.2 the said library
510has an obscure bug where the various functions related to time
511(such as time() and gettimeofday()) return broken values, and
512therefore in AIX 4.2 Perl is not linked against the libC_r.
513
514=head1 AUTHORS
515
516Rainer Tammer <tammer@tammer.net>
517
518=cut
519

README.amiga

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see. It is written in the POD format (see perlpod manpage) which is
5specially designed to be readable as is.
6
7=head1 NAME
8
9perlamiga - Perl under AmigaOS 4.1
10
11=head1 NOTE
12
13This is a port of Perl 5.22.1, it is a fresh port and not in any way
14compatible with my previous ports of Perl 5.8 and 5.16.3. This means
15you will need to reinstall / rebuild any third party modules you have
16installed.
17
18newlib.library version 53.28 or greater is required.
19
20=head1 SYNOPSIS
21
22Once perl is installed you can read this document in the following way
23
24	sh -c "perldoc perlamiga"
25
26or you may read I<as is>: either as F<README.amiga>, or F<pod/perlamiga.pod>.
27
28=cut
29
30       NAME
31       SYNOPSIS
32       DESCRIPTION
33         -  Prerequisites
34         -  Starting Perl programs under AmigaOS
35         -  Shortcomings of Perl under AmigaOS
36       INSTALLATION
37       CHANGES
38
39=head1 DESCRIPTION
40
41=head2 Prerequisites for running Perl 5.22.1 under AmigaOS 4.1
42
43=over 6
44
45=item B<AmigaOS 4.1 update 6 with all updates applied as of 9th October 2013>
46
47The most important of which is:
48
49=item B<newlib.library version 53.28 or greater>
50
51=item B<AmigaOS SDK>
52
53Perl installs into the SDK directory structure and expects many of the
54build tools present in the SDK to be available. So for the best results
55install the SDK first.
56
57=item B<abc-shell>
58
59If you do not have the SDK installed you must at least have abc-shell
60installed or some other suitable sh port. This is required to run
61external commands and should be available as 'sh' in your path.
62
63=back
64
65=head2 Starting Perl programs under AmigaOS 4.1
66
67Perl may be run from the AmigaOS shell but for best results should be
68run under abc-shell.  (abc-shell handles file globbing, pattern
69expansion, and sets up environment variables in the UN*Xy way that
70Perl expects.)
71
72For example:
73
74	New Shell process 10
75	10.AmigaOS4:> sh
76	/AmigaOS4>perl path:to/myprog arg1 arrg2 arg3
77
78Abc-shell can also launch programs via the #! syntax at the start of
79the program file, it's best use the form #!SDK:Local/C/perl so that
80the AmigaOS shell may also find perl in the same way. AmigaOS requires
81the script bit to be set for this to work
82
83	10.AmigaOS4:> sh
84	/AmigaOS4>myprog arg1 arrg2 arg3
85
86=head2 Limitations of Perl under AmigaOS 4.1
87
88=over 6
89
90=item B<Nested Piped programs can crash when run from older abc-shells>
91
92abc-shell version 53.2 has a bug that can cause crashes in the
93subprocesses used to run piped programs, if a later version is
94available you should install it instead.
95
96=item B<Incorrect or unexpected command line unescaping>
97
98newlib.library 53.30 and earlier incorrectly unescape slashed escape
99sequences e.g. \" \n \t etc requiring unusual extra escaping.
100
101=item B<Starting subprocesses via open has limitations>
102
103	open FH, "command |"
104
105Subprocesses started with open use a minimal popen() routine and
106therefore they do not return pids usable with waitpid etc.
107
108=item If you find any other limitations or bugs then let me know.
109
110Please report bugs in this version of perl to andy@broad.ology.org.uk
111in the first instance.
112
113=back
114
115=head1 INSTALLATION
116
117This guide assumes you have obtained a prebuilt archive from os4depot.net.
118
119Unpack the main archive to a temporary location (RAM: is fine).
120
121Execute the provided install script from shell or via its icon.
122
123You B<must not> attempt to install by hand.
124
125Once installed you may delete the temporary archive.
126
127This approach will preserve links in the installation without creating
128duplicate binaries.
129
130If you have the earlier ports perl 5.16 or 5.8 installed you may like
131to rename your perl executable to perl516 or perl58 or something
132similar before the installation of 5.22.1, this will allow you to use
133both versions at the same time.
134
135=head1 Amiga Specific Modules
136
137=head2 Amiga::ARexx
138
139The Amiga::ARexx module allows you to easily create a perl based ARexx
140host or to send ARexx commands to other programs.
141
142Try C<perldoc Amiga::ARexx> for more info.
143
144=head2 Amiga::Exec
145
146The Amiga::Exec module introduces support for Wait().
147
148Try C<perldoc Amiga::Exec> for more info.
149
150=head1 BUILDING
151
152To build perl under AmigaOS from the patched sources you will need to
153have a recent version of the SDK. Version 53.29 is recommended,
154earlier versions will probably work too.
155
156With the help of Jarkko Hietaniemi the Configure system has been tweaked to
157run under abc-shell so the recommend build process is as follows.
158
159	stack 2000000
160	sh Configure -de
161	gmake
162
163This will build the default setup that installs under SDK:local/newlib/lib/
164
165=head1 CHANGES
166
167=over 6
168
169=item B<August 2015>
170
171=over 2
172
173=item Port to Perl 5.22
174
175=item Add handling of NIL: to afstat()
176
177=item Fix inheritance of environment variables by subprocesses.
178
179=item Fix exec, and exit in "forked" subprocesses.
180
181=item Fix issue with newlib's unlink, which could cause infinite loops.
182
183=item Add flock() emulation using IDOS->LockRecord thanks to Tony Cook
184for the suggestion.
185
186=item Fix issue where kill was using the wrong kind of process ID
187
188=back
189
190=item B<27th November 2013>
191
192=over 2
193
194=item Create new installation system based on installperl links
195and Amiga protection bits now set correctly.
196
197=item Pod now defaults to text.
198
199=item File::Spec should now recognise an Amiga style absolute path as well
200as an Unix style one. Relative paths must always be Unix style.
201
202=back
203
204=item B<20th November 2013>
205
206=over 2
207
208=item Configured to use SDK:Local/C/perl to start standard scripts
209
210=item Added Amiga::Exec module with support for Wait() and AmigaOS signal numbers.
211
212=back
213
214=item B<10th October 13>
215
216First release of port to 5.16.3.
217
218=back
219
220=head1 SEE ALSO
221
222You like this port?  See L<http://www.broad.ology.org.uk/amiga/>
223for how you can help.
224
225=cut
226

README.android

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see. It is written in the POD format (see pod/perlpod.pod) which is
5specially designed to be readable as is.
6
7=head1 NAME
8
9perlandroid - Perl under Android
10
11=head1 SYNOPSIS
12
13The first portions of this document contains instructions
14to cross-compile Perl for Android 2.0 and later, using the
15binaries provided by Google.  The latter portions describe how to build
16perl native using one of the toolchains available on the Play Store.
17
18=head1 DESCRIPTION
19
20This document describes how to set up your host environment when
21attempting to build Perl for Android.
22
23=head1 Cross-compilation
24
25These instructions assume an Unixish build environment on your host system;
26they've been tested on Linux and OS X, and may work on Cygwin and MSYS.
27While Google also provides an NDK for Windows, these steps won't work
28native there, although it may be possible to cross-compile through different
29means.
30
31If your host system's architecture is 32 bits, remember to change the
32C<x86_64>'s below to C<x86>'s.  On a similar vein, the examples below
33use the 4.8 toolchain; if you want to use something older or newer (for
34example, the 4.4.3 toolchain included in the 8th revision of the NDK), just
35change those to the relevant version.
36
37=head2 Get the Android Native Development Kit (NDK)
38
39You can download the NDK from L<https://developer.android.com/tools/sdk/ndk/index.html>.
40You'll want the normal, non-legacy version.
41
42=head2 Determine the architecture you'll be cross-compiling for
43
44There's three possible options: arm-linux-androideabi for ARM,
45mipsel-linux-android for MIPS, and simply x86 for x86.
46As of 2014, most Android devices run on ARM, so that is generally a safe bet.
47
48With those two in hand, you should add
49
50  $ANDROID_NDK/toolchains/$TARGETARCH-4.8/prebuilt/`uname | tr '[A-Z]' '[a-z]'`-x86_64/bin
51
52to your C<PATH>, where C<$ANDROID_NDK> is the location where you unpacked the
53NDK, and C<$TARGETARCH> is your target's architecture.
54
55=head2 Set up a standalone toolchain
56
57This creates a working sysroot that we can feed to Configure later.
58
59    $ export ANDROID_TOOLCHAIN=/tmp/my-toolchain-$TARGETARCH
60    $ export SYSROOT=$ANDROID_TOOLCHAIN/sysroot
61    $ $ANDROID_NDK/build/tools/make-standalone-toolchain.sh \
62            --platform=android-9 \
63            --install-dir=$ANDROID_TOOLCHAIN \
64            --system=`uname | tr '[A-Z]' '[a-z]'`-x86_64 \
65            --toolchain=$TARGETARCH-4.8
66
67=head2 adb or ssh?
68
69adb is the Android Debug Bridge.  For our purposes, it's basically a way
70of establishing an ssh connection to an Android device without having to
71install anything on the device itself, as long as the device is either on
72the same local network as the host, or it is connected to the host through
73USB.
74
75Perl can be cross-compiled using either adb or a normal ssh connection;
76in general, if you can connect your device to the host using a USB port,
77or if you don't feel like installing an sshd app on your device,
78you may want to use adb, although you may be forced to switch to ssh if
79your device is not rooted and you're unlucky -- more on that later.
80Alternatively, if you're cross-compiling to an emulator, you'll have to
81use adb.
82
83=head3 adb
84
85To use adb, download the Android SDK from L<https://developer.android.com/sdk/index.html>.
86The "SDK Tools Only" version should suffice -- if you downloaded the ADT
87Bundle, you can find the sdk under F<$ADT_BUNDLE/sdk/>.
88
89Add F<$ANDROID_SDK/platform-tools> to your C<PATH>, which should give you access
90to adb.  You'll now have to find your device's name using C<adb devices>,
91and later pass that to Configure through C<-Dtargethost=$DEVICE>.
92
93However, before calling Configure, you need to check if using adb is a
94viable choice in the first place.  Because Android doesn't have a F</tmp>,
95nor does it allow executables in the sdcard, we need to find somewhere in
96the device for Configure to put some files in, as well as for the tests
97to run in. If your device is rooted, then you're good.  Try running these:
98
99    $ export TARGETDIR=/mnt/asec/perl
100    $ adb -s $DEVICE shell "echo sh -c '\"mkdir $TARGETDIR\"' | su --"
101
102Which will create the directory we need, and you can move on to the next
103step.  F</mnt/asec> is mounted as a tmpfs in Android, but it's only
104accessible to root.
105
106If your device is not rooted, you may still be in luck. Try running this:
107
108    $ export TARGETDIR=/data/local/tmp/perl
109    $ adb -s $DEVICE shell "mkdir $TARGETDIR"
110
111If the command works, you can move to the next step, but beware:
112B<You'll have to remove the directory from the device once you are done!
113Unlike F</mnt/asec>, F</data/local/tmp> may not get automatically garbage
114collected once you shut off the phone>.
115
116If neither of those work, then you can't use adb to cross-compile to your
117device.  Either try rooting it, or go for the ssh route.
118
119=head3 ssh
120
121To use ssh, you'll need to install and run a sshd app and set it up
122properly.  There are several paid and free apps that do this rather
123easily, so you should be able to spot one on the store.
124Remember that Perl requires a passwordless connection, so set up a
125public key.
126
127Note that several apps spew crap to stderr every time you
128connect, which can throw off Configure.  You may need to monkeypatch
129the part of Configure that creates C<run-ssh> to have it discard stderr.
130
131Since you're using ssh, you'll have to pass some extra arguments to
132Configure:
133
134  -Dtargetrun=ssh -Dtargethost=$TARGETHOST -Dtargetuser=$TARGETUSER -Dtargetport=$TARGETPORT
135
136=head2 Configure and beyond
137
138With all of the previous done, you're now ready to call Configure.
139
140If using adb, a "basic" Configure line will look like this:
141
142  $ ./Configure -des -Dusedevel -Dusecrosscompile -Dtargetrun=adb \
143      -Dcc=$TARGETARCH-gcc   \
144      -Dsysroot=$SYSROOT     \
145      -Dtargetdir=$TARGETDIR \
146      -Dtargethost=$DEVICE
147
148If using ssh, it's not too different -- we just change targetrun to ssh,
149and pass in targetuser and targetport.  It ends up looking like this:
150
151  $ ./Configure -des -Dusedevel -Dusecrosscompile -Dtargetrun=ssh \
152      -Dcc=$TARGETARCH-gcc        \
153      -Dsysroot=$SYSROOT          \
154      -Dtargetdir=$TARGETDIR      \
155      -Dtargethost="$TARGETHOST"  \
156      -Dtargetuser=$TARGETUSER    \
157      -Dtargetport=$TARGETPORT
158
159Now you're ready to run C<make> and C<make test>!
160
161As a final word of warning, if you're using adb, C<make test> may appear to
162hang; this is because it doesn't output anything until it finishes
163running all tests.  You can check its progress by logging into the
164device, moving to F<$TARGETDIR>, and looking at the file F<output.stdout>.
165
166=head3 Notes
167
168=over
169
170=item *
171
172If you are targetting x86 Android, you will have to change C<$TARGETARCH-gcc>
173to C<i686-linux-android-gcc>.
174
175=item *
176
177On some older low-end devices -- think early 2.2 era -- some tests,
178particularly F<t/re/uniprops.t>, may crash the phone, causing it to turn
179itself off once, and then back on again.
180
181=back
182
183=head1 Native Builds
184
185While Google doesn't provide a native toolchain for Android,
186you can still get one from the Play Store.
187
188=head2 CCTools
189
190You may be able to get the CCTools app, which is free.
191Keep in mind that you want a full toolchain;
192some apps tend to default to installing only a barebones
193version without some important utilities, like ar or nm.
194
195Once you have the toolchain set up properly, the only
196remaining hurdle is actually locating where in the device it was installed
197in.  For example, CCTools installs its toolchain in
198F</data/data/com.pdaxrom.cctools/root/cctools>.  With the path in hand,
199compiling perl is little more than:
200
201 export SYSROOT=<location of the native toolchain>
202 export LD_LIBRARY_PATH="$SYSROOT/lib:`pwd`:`pwd`/lib:`pwd`/lib/auto:$LD_LIBRARY_PATH"
203 sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib"
204
205=head2 Termux
206
207L<Termux|https://termux.com/> provides an Android terminal emulator and Linux environment.
208It comes with a cross-compiled perl already installed.
209
210Natively compiling perl 5.30 or later should be as straightforward as:
211
212 sh Configure -des -Alibpth="/system/lib /vendor/lib"
213
214This certainly works on Android 8.1 (Oreo) at least...
215
216=head1 AUTHOR
217
218Brian Fraser <fraserbn@gmail.com>
219
220=cut
221

README.bs2000

1# vim: syntax=pod
2
3This document is written in pod format hence there are punctuation
4characters in odd places.  Do not worry, you've apparently got the
5ASCII->EBCDIC translation worked out correctly.  You can read more
6about pod in pod/perlpod.pod or the short summary in the INSTALL file.
7
8=head1 NAME
9
10perlbs2000 - building and installing Perl for BS2000.
11
12B<This document needs to be updated, but we don't know what it should say.
13Please submit comments to L<https://github.com/Perl/perl5/issues>.>
14
15=head1 SYNOPSIS
16
17This document will help you Configure, build, test and install Perl
18on BS2000 in the POSIX subsystem.
19
20=head1 DESCRIPTION
21
22This is a ported perl for the POSIX subsystem in BS2000 VERSION OSD
23V3.1A or later.  It may work on other versions, but we started porting
24and testing it with 3.1A and are currently using Version V4.0A.
25
26You may need the following GNU programs in order to install perl:
27
28=head2 gzip on BS2000
29
30We used version 1.2.4, which could be installed out of the box with
31one failure during 'make check'.
32
33=head2 bison on BS2000
34
35The yacc coming with BS2000 POSIX didn't work for us.  So we had to
36use bison.  We had to make a few changes to perl in order to use the
37pure (reentrant) parser of bison.  We used version 1.25, but we had to
38add a few changes due to EBCDIC.  See below for more details
39concerning yacc.
40
41=head2 Unpacking Perl Distribution on BS2000
42
43To extract an ASCII tar archive on BS2000 POSIX you need an ASCII
44filesystem (we used the mountpoint /usr/local/ascii for this).  Now
45you extract the archive in the ASCII filesystem without
46I/O-conversion:
47
48cd /usr/local/ascii
49export IO_CONVERSION=NO
50gunzip < /usr/local/src/perl.tar.gz | pax -r
51
52You may ignore the error message for the first element of the archive
53(this doesn't look like a tar archive / skipping to next file...),
54it's only the directory which will be created automatically anyway.
55
56After extracting the archive you copy the whole directory tree to your
57EBCDIC filesystem.  B<This time you use I/O-conversion>:
58
59cd /usr/local/src
60IO_CONVERSION=YES
61cp -r /usr/local/ascii/perl5.005_02 ./
62
63=head2 Compiling Perl on BS2000
64
65There is a "hints" file for BS2000 called hints.posix-bc (because
66posix-bc is the OS name given by `uname`) that specifies the correct
67values for most things.  The major problem is (of course) the EBCDIC
68character set.  We have german EBCDIC version.
69
70Because of our problems with the native yacc we used GNU bison to
71generate a pure (=reentrant) parser for perly.y.  So our yacc is
72really the following script:
73
74-----8<-----/usr/local/bin/yacc-----8<-----
75#! /usr/bin/sh
76
77# Bison as a reentrant yacc:
78
79# save parameters:
80params=""
81while [[ $# -gt 1 ]]; do
82    params="$params $1"
83    shift
84done
85
86# add flag %pure_parser:
87
88tmpfile=/tmp/bison.$$.y
89echo %pure_parser > $tmpfile
90cat $1 >> $tmpfile
91
92# call bison:
93
94echo "/usr/local/bin/bison --yacc $params $1\t\t\t(Pure Parser)"
95/usr/local/bin/bison --yacc $params $tmpfile
96
97# cleanup:
98
99rm -f $tmpfile
100-----8<----------8<-----
101
102We still use the normal yacc for a2p.y though!!!  We made a softlink
103called byacc to distinguish between the two versions:
104
105ln -s /usr/bin/yacc /usr/local/bin/byacc
106
107We build perl using GNU make.  We tried the native make once and it
108worked too.
109
110=head2 Testing Perl on BS2000
111
112We still got a few errors during C<make test>.  Some of them are the
113result of using bison.  Bison prints I<parser error> instead of I<syntax
114error>, so we may ignore them.  The following list shows
115our errors, your results may differ:
116
117op/numconvert.......FAILED tests 1409-1440
118op/regexp...........FAILED tests 483, 496
119op/regexp_noamp.....FAILED tests 483, 496
120pragma/overload.....FAILED tests 152-153, 170-171
121pragma/warnings.....FAILED tests 14, 82, 129, 155, 192, 205, 207
122lib/bigfloat........FAILED tests 351-352, 355
123lib/bigfltpm........FAILED tests 354-355, 358
124lib/complex.........FAILED tests 267, 487
125lib/dumper..........FAILED tests 43, 45
126Failed 11/231 test scripts, 95.24% okay. 57/10595 subtests failed, 99.46% okay.
127
128=head2 Installing Perl on BS2000
129
130We have no nroff on BS2000 POSIX (yet), so we ignored any errors while
131installing the documentation.
132
133
134=head2 Using Perl in the Posix-Shell of BS2000
135
136BS2000 POSIX doesn't support the shebang notation
137(C<#!/usr/local/bin/perl>), so you have to use the following lines
138instead:
139
140: # use perl
141    eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
142        if 0; # ^ Run only under a shell
143
144=head2 Using Perl in "native" BS2000
145
146We don't have much experience with this yet, but try the following:
147
148Copy your Perl executable to a BS2000 LLM using bs2cp:
149
150C<bs2cp /usr/local/bin/perl 'bs2:perl(perl,l)'>
151
152Now you can start it with the following (SDF) command:
153
154C</START-PROG FROM-FILE=*MODULE(PERL,PERL),PROG-MODE=*ANY,RUN-MODE=*ADV>
155
156First you get the BS2000 commandline prompt ('*').  Here you may enter
157your parameters, e.g. C<-e 'print "Hello World!\\n";'> (note the
158double backslash!) or C<-w> and the name of your Perl script.
159Filenames starting with C</> are searched in the Posix filesystem,
160others are searched in the BS2000 filesystem.  You may even use
161wildcards if you put a C<%> in front of your filename (e.g. C<-w
162checkfiles.pl %*.c>).  Read your C/C++ manual for additional
163possibilities of the commandline prompt (look for
164PARAMETER-PROMPTING).
165
166=head2 Floating point anomalies on BS2000
167
168There appears to be a bug in the floating point implementation on BS2000 POSIX
169systems such that calling int() on the product of a number and a small
170magnitude number is not the same as calling int() on the quotient of
171that number and a large magnitude number.  For example, in the following
172Perl code:
173
174    my $x = 100000.0;
175    my $y = int($x * 1e-5) * 1e5; # '0'
176    my $z = int($x / 1e+5) * 1e5;  # '100000'
177    print "\$y is $y and \$z is $z\n"; # $y is 0 and $z is 100000
178
179Although one would expect the quantities $y and $z to be the same and equal
180to 100000 they will differ and instead will be 0 and 100000 respectively.
181
182=head2 Using PerlIO and different encodings on ASCII and EBCDIC partitions
183
184Since version 5.8 Perl uses the new PerlIO on BS2000.  This enables
185you using different encodings per IO channel.  For example you may use
186
187    use Encode;
188    open($f, ">:encoding(ascii)", "test.ascii");
189    print $f "Hello World!\n";
190    open($f, ">:encoding(posix-bc)", "test.ebcdic");
191    print $f "Hello World!\n";
192    open($f, ">:encoding(latin1)", "test.latin1");
193    print $f "Hello World!\n";
194    open($f, ">:encoding(utf8)", "test.utf8");
195    print $f "Hello World!\n";
196
197to get two files containing "Hello World!\n" in ASCII, EBCDIC, ISO
198Latin-1 (in this example identical to ASCII) respective UTF-EBCDIC (in
199this example identical to normal EBCDIC).  See the documentation of
200Encode::PerlIO for details.
201
202As the PerlIO layer uses raw IO internally, all this totally ignores
203the type of your filesystem (ASCII or EBCDIC) and the IO_CONVERSION
204environment variable.  If you want to get the old behavior, that the
205BS2000 IO functions determine conversion depending on the filesystem
206PerlIO still is your friend.  You use IO_CONVERSION as usual and tell
207Perl, that it should use the native IO layer:
208
209    export IO_CONVERSION=YES
210    export PERLIO=stdio
211
212Now your IO would be ASCII on ASCII partitions and EBCDIC on EBCDIC
213partitions.  See the documentation of PerlIO (without C<Encode::>!)
214for further possibilities.
215
216=head1 AUTHORS
217
218Thomas Dorner
219
220=head1 SEE ALSO
221
222L<INSTALL>, L<perlport>.
223
224=head2 Mailing list
225
226If you are interested in the z/OS (formerly known as OS/390)
227and POSIX-BC (BS2000) ports of Perl then see the perl-mvs mailing list.
228To subscribe, send an empty message to perl-mvs-subscribe@perl.org.
229
230See also:
231
232    https://lists.perl.org/list/perl-mvs.html
233
234There are web archives of the mailing list at:
235
236    https://www.nntp.perl.org/group/perl.mvs/
237
238=head1 HISTORY
239
240This document was originally written by Thomas Dorner for the 5.005
241release of Perl.
242
243This document was podified for the 5.6 release of perl 11 July 2000.
244
245=cut
246

README.cn

1# vim: syntax=pod
2
3如果你用一般的文字编辑器阅览这份文件, 请忽略文中奇特的注记字符.
4这份文件是以 POD (简明文件格式) 写成; 这种格式是为了能让人直接阅读,
5而特别设计的. 关于此格式的进一步信息, 请参考 perlpod 在线文档.
6
7=encoding utf8
8
9=head1 NAME
10
11perlcn - 简体中文 Perl 指南
12
13=head1 DESCRIPTION
14
15欢迎来到 Perl 的天地!
16
17从 5.8.0 版开始, Perl 具备了完善的 Unicode (统一码) 支持,
18也连带支持了许多拉丁语系以外的编码方式; CJK (中日韩) 便是其中的一部分.
19Unicode 是国际性的标准, 试图涵盖世界上所有的字符: 西方世界, 东方世界,
20以及两者间的一切 (希腊文, 叙利亚文, 阿拉伯文, 希伯来文, 印度文,
21印地安文, 等等). 它也容纳了多种操作系统与平台 (如 PC 及麦金塔).
22
23Perl 本身以 Unicode 进行操作. 这表示 Perl 内部的字符串数据可用 Unicode
24表示; Perl 的函数与运算符 (例如正则表达式匹配) 也能对 Unicode 进行操作.
25在输入及输出时, 为了处理以 Unicode 之前的编码方式储存的数据, Perl
26提供了 Encode 这个模块, 可以让你轻易地读写使用旧有的编码格式的数据.
27
28Encode 扩展模块支持下列简体中文的编码方式 ('gb2312' 表示 'euc-cn'):
29
30    euc-cn	Unix 扩展字符集, 也就是俗称的国标码
31    gb2312-raw	未经处理的 (低比特) GB2312 字符表
32    gb12345	未经处理的中国用繁体中文编码
33    iso-ir-165	GB2312 + GB6345 + GB8565 + 新增字符
34    cp936	字码页 936, 也可以用 'GBK' (扩充国标码) 指明
35    hz		7 比特逸出式 GB2312 编码
36
37举例来说, 将 EUC-CN 编码的文件转成 Unicode, 只需输入以下命令:
38
39    perl -Mencoding=euc-cn,STDOUT,utf8 -pe1 < file.euc-cn > file.utf8
40
41Perl 也内附了 "piconv", 一个完全以 Perl 写成的字符转换工具程序, 用法如下:
42
43    piconv -f euc-cn -t utf8 < file.euc-cn > file.utf8
44    piconv -f utf8 -t euc-cn < file.utf8 > file.euc-cn
45
46另外, 利用 encoding 模块, 你可以轻易写出以字符为单位的代码, 如下所示:
47
48    #!/usr/bin/env perl
49    # 启动 euc-cn 字串解析; 标准输出入及标准错误都设为 euc-cn 编码
50    use encoding 'euc-cn', STDIN => 'euc-cn', STDOUT => 'euc-cn';
51    print length("骆驼");	     #  2 (双引号表示字符)
52    print length('骆驼');	     #  4 (单引号表示字节)
53    print index("谆谆教诲", "蛔唤"); # -1 (不包含此子字符串)
54    print index('谆谆教诲', '蛔唤'); #  1 (从第二个字节开始)
55
56在最后一列例子里, "谆" 的第二个字节与 "谆" 的第一个字节结合成 EUC-CN
57码的 "蛔"; "谆" 的第二个字节则与 "教" 的第一个字节结合成 "唤".
58这解决了以前 EUC-CN 码匹配处理上常见的问题.
59
60=head2 额外的中文编码
61
62如果需要更多的中文编码, 可以从 CPAN (L<https://www.cpan.org/>) 下载
63Encode::HanExtra 模块. 它目前提供下列编码方式:
64
65    gb18030	扩充过的国标码, 包含繁体中文
66
67另外, Encode::HanConvert 模块则提供了简繁转换用的两种编码:
68
69    big5-simp	Big5 繁体中文与 Unicode 简体中文互转
70    gbk-trad	GBK 简体中文与 Unicode 繁体中文互转
71
72若想在 GBK 与 Big5 之间互转, 请参考该模块内附的 b2g.plg2b.pl 两个程序,
73或在程序内使用下列写法:
74
75    use Encode::HanConvert;
76    $euc_cn = big5_to_gb($big5); # 从 Big5 转为 GBK
77    $big5 = gb_to_big5($euc_cn); # 从 GBK 转为 Big5
78
79=head2 进一步的信息
80
81请参考 Perl 内附的大量说明文件 (不幸全是用英文写的), 来学习更多关于
82Perl 的知识, 以及 Unicode 的使用方式. 不过, 外部的资源相当丰富:
83
84=head2 提供 Perl 资源的网址
85
86=over 4
87
88=item L<https://www.perl.org/>
89
90=back
91
92Perl 的首页
93
94=over 4
95
96=item L<https://www.perl.com/>
97
98由 Perl 基金会运营的文章辑录
99
100=item L<https://www.cpan.org/>
101
102Perl 综合典藏网 (Comprehensive Perl Archive Network)
103
104=item L<https://lists.perl.org/>
105
106Perl 邮递论坛一览
107
108=back
109
110=head2 学习 Perl 的网址
111
112=over 4
113
114=item L<http://www.oreilly.com.cn/index.php?func=booklist&cat=68>
115
116简体中文版的欧莱礼 Perl 书藉
117
118=back
119
120=head2 Perl 使用者集会
121
122=over 4
123
124=item L<https://www.pm.org/groups/asia.html>
125
126中国 Perl 推广组一览
127
128=back
129
130=head2 Unicode 相关网址
131
132=over 4
133
134=item L<https://www.unicode.org/>
135
136Unicode 学术学会 (Unicode 标准的制定者)
137
138=item L<https://www.cl.cam.ac.uk/%7Emgk25/unicode.html>
139
140Unix/Linux 上的 UTF-8 及 Unicode 常见问题解答
141
142=back
143
144=head1 SEE ALSO
145
146L<Encode>, L<Encode::CN>, L<encoding>, L<perluniintro>, L<perlunicode>
147
148=head1 AUTHORS
149
150Jarkko Hietaniemi E<lt>jhi@iki.fiE<gt>
151
152Audrey Tang (唐凤) E<lt>audreyt@audreyt.orgE<gt>
153
154Sizhe Zhao E<lt>prc.zhao@outlook.comE<gt>
155
156=cut
157

README.cygwin

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see. It is written in the POD format (see F<pod/perlpod.pod>) which is
5specially designed to be readable as is.
6
7=head1 NAME
8
9perlcygwin - Perl for Cygwin
10
11=head1 SYNOPSIS
12
13This document will help you configure, make, test and install Perl
14on Cygwin.  This document also describes features of Cygwin that will
15affect how Perl behaves at runtime.
16
17B<NOTE:> There are pre-built Perl packages available for Cygwin and a
18version of Perl is provided in the normal Cygwin install.  If you do
19not need to customize the configuration, consider using one of those
20packages.
21
22
23=head1 PREREQUISITES FOR COMPILING PERL ON CYGWIN
24
25=head2 Cygwin = GNU+Cygnus+Windows (Don't leave UNIX without it)
26
27The Cygwin tools are ports of the popular GNU development tools for Win32
28platforms.  They run thanks to the Cygwin library which provides the UNIX
29system calls and environment these programs expect.  More information
30about this project can be found at:
31
32L<https://www.cygwin.com/>
33
34A recent net or commercial release of Cygwin is required.
35
36At the time this document was last updated, Cygwin 3.0.7 was current.
37
38
39=head2 Cygwin Configuration
40
41While building Perl some changes may be necessary to your Cygwin setup so
42that Perl builds cleanly.  These changes are B<not> required for normal
43Perl usage.
44
45B<NOTE:> The binaries that are built will run on all Win32 versions.
46They do not depend on your host system or your
47Cygwin configuration (binary/text mounts, cygserver).
48The only dependencies come from hard-coded pathnames like F</usr/local>.
49However, your host system and Cygwin configuration will affect Perl's
50runtime behavior (see L</"TEST">).
51
52=over 4
53
54=item * C<PATH>
55
56Set the C<PATH> environment variable so that Configure finds the Cygwin
57versions of programs. Any not-needed Windows directories should be removed or
58moved to the end of your C<PATH>.
59
60=item * I<nroff>
61
62If you do not have I<nroff> (which is part of the I<groff> package),
63Configure will B<not> prompt you to install I<man> pages.
64
65=back
66
67=head1 CONFIGURE PERL ON CYGWIN
68
69The default options gathered by Configure with the assistance of
70F<hints/cygwin.sh> will build a Perl that supports dynamic loading
71(which requires a shared F<cygperl5_16.dll>).
72
73This will run Configure and keep a record:
74
75  ./Configure 2>&1 | tee log.configure
76
77If you are willing to accept all the defaults run Configure with B<-de>.
78However, several useful customizations are available.
79
80=head2 Stripping Perl Binaries on Cygwin
81
82It is possible to strip the EXEs and DLLs created by the build process.
83The resulting binaries will be significantly smaller.  If you want the
84binaries to be stripped, you can either add a B<-s> option when Configure
85prompts you,
86
87  Any additional ld flags (NOT including libraries)? [none] -s
88  Any special flags to pass to g++ to create a dynamically loaded
89  library?
90  [none] -s
91  Any special flags to pass to gcc to use dynamic linking? [none] -s
92
93or you can edit F<hints/cygwin.sh> and uncomment the relevant variables
94near the end of the file.
95
96=head2 Optional Libraries for Perl on Cygwin
97
98Several Perl functions and modules depend on the existence of
99some optional libraries.  Configure will find them if they are
100installed in one of the directories listed as being used for library
101searches.  Pre-built packages for most of these are available from
102the Cygwin installer.
103
104=over 4
105
106=item * C<-lcrypt>
107
108The crypt package distributed with Cygwin is a Linux compatible 56-bit
109DES crypt port by Corinna Vinschen.
110
111Alternatively, the crypt libraries in GNU libc have been ported to Cygwin.
112
113As of libcrypt 1.3 (March 2016), you will need to install the
114libcrypt-devel package for Configure to detect crypt().
115
116=item * C<-lgdbm_compat> (C<use GDBM_File>)
117
118GDBM is available for Cygwin.
119
120NOTE: The GDBM library only works on NTFS partitions.
121
122=item * C<-ldb> (C<use DB_File>)
123
124BerkeleyDB is available for Cygwin.
125
126NOTE: The BerkeleyDB library only completely works on NTFS partitions.
127
128=item * C<cygserver> (C<use IPC::SysV>)
129
130A port of SysV IPC is available for Cygwin.
131
132NOTE: This has B<not> been extensively tested.  In particular,
133C<d_semctl_semun> is undefined because it fails a Configure test.  It
134also creates a compile time dependency because F<perl.h> includes
135F<<sys/ipc.h>> and F<<sys/sem.h>> (which will be required in the
136future when compiling CPAN modules). CURRENTLY NOT SUPPORTED!
137
138=item * C<-lutil>
139
140Included with the standard Cygwin netrelease is the inetutils package
141which includes libutil.a.
142
143=back
144
145=head2 Configure-time Options for Perl on Cygwin
146
147The F<INSTALL> document describes several Configure-time options.  Some of
148these will work with Cygwin, others are not yet possible.  Also, some of
149these are experimental.  You can either select an option when Configure
150prompts you or you can define (undefine) symbols on the command line.
151
152=over 4
153
154=item * C<-Uusedl>
155
156Undefining this symbol forces Perl to be compiled statically.
157
158=item * C<-Dusemymalloc>
159
160By default Perl does not use the C<malloc()> included with the Perl source,
161because it was slower and not entirely thread-safe.  If you want to force
162Perl to build with the old -Dusemymalloc define this.
163
164=item * C<-Uuseperlio>
165
166Undefining this symbol disables the PerlIO abstraction.  PerlIO is now the
167default; it is not recommended to disable PerlIO.
168
169=item * C<-Dusemultiplicity>
170
171Multiplicity is required when embedding Perl in a C program and using
172more than one interpreter instance.  This is only required when you build
173a not-threaded perl with C<-Uuseithreads>.
174
175=item * C<-Uuse64bitint>
176
177By default Perl uses 64 bit integers.  If you want to use smaller 32 bit
178integers, define this symbol.
179
180=item * C<-Duselongdouble>
181
182I<gcc> supports long doubles (12 bytes).  However, several additional
183long double math functions are necessary to use them within Perl
184(I<{atan2, cos, exp, floor, fmod, frexp, isnan, log, modf, pow, sin, sqrt}l,
185strtold>).
186These are B<not> yet available with newlib, the Cygwin libc.
187
188=item * C<-Uuseithreads>
189
190Define this symbol if you want not-threaded faster perl.
191
192=item * C<-Duselargefiles>
193
194Cygwin uses 64-bit integers for internal size and position calculations,
195this will be correctly detected and defined by Configure.
196
197=item * C<-Dmksymlinks>
198
199Use this to build perl outside of the source tree.  Details can be
200found in the F<INSTALL> document.  This is the recommended way to
201build perl from sources.
202
203=back
204
205=head1 MAKE ON CYGWIN
206
207Simply run I<make> and wait:
208
209  make -jn 2>&1 | tee log.make
210
211where I<n> is the maximum number of simultaneous compilations you want;
212omitting this parameter is the same as specifying C<-j1>.
213
214=head1 TEST ON CYGWIN
215
216There are two steps to running the test suite:
217
218  make test 2>&1 | tee log.make-test
219
220  cd t; ./perl harness 2>&1 | tee ../log.harness
221
222The same tests are run both times, but more information is provided when
223running as C<./perl harness>, and you can run the tests in parallel by
224instead specifying
225
226  cd t; TEST_JOBS=n ./perl harness 2>&1 | tee ../log.harness
227
228where I<n> is the maximum number of tests to run simulataneously.
229
230Test results vary depending on your host system and your Cygwin
231configuration.  If a test can pass in some Cygwin setup, it is always
232attempted and explainable test failures are documented.  It is possible
233for Perl to pass all the tests, but it is more likely that some tests
234will fail for one of the reasons listed below.
235
236=head2 File Permissions on Cygwin
237
238UNIX file permissions are based on sets of mode bits for
239{read,write,execute} for each {user,group,other}.  By default Cygwin
240only tracks the Win32 read-only attribute represented as the UNIX file
241user write bit (files are always readable, files are executable if they
242have a F<.{com,bat,exe}> extension or begin with C<#!>, directories are
243always readable and executable).  On WinNT with the I<ntea> C<CYGWIN>
244setting, the additional mode bits are stored as extended file attributes.
245On WinNT with the default I<ntsec> C<CYGWIN> setting, permissions use the
246standard WinNT security descriptors and access control lists. Without one of
247these options, these tests will fail (listing not updated yet):
248
249  Failed Test           List of failed
250  ------------------------------------
251  io/fs.t               5, 7, 9-10
252  lib/anydbm.t          2
253  lib/db-btree.t        20
254  lib/db-hash.t         16
255  lib/db-recno.t        18
256  lib/gdbm.t            2
257  lib/ndbm.t            2
258  lib/odbm.t            2
259  lib/sdbm.t            2
260  op/stat.t             9, 20 (.tmp not an executable extension)
261
262=head2 NDBM_File and ODBM_File do not work on FAT filesystems
263
264Do not use NDBM_File or ODBM_File on FAT filesystem.  They can be
265built on a FAT filesystem, but many tests will fail:
266
267 ../ext/NDBM_File/ndbm.t       13  3328    71   59  83.10%  1-2 4 16-71
268 ../ext/ODBM_File/odbm.t      255 65280    ??   ??       %  ??
269 ../lib/AnyDBM_File.t           2   512    12    2  16.67%  1 4
270 ../lib/Memoize/t/errors.t      0   139    11    5  45.45%  7-11
271 ../lib/Memoize/t/tie_ndbm.t   13  3328     4    4 100.00%  1-4
272 run/fresh_perl.t                          97    1   1.03%  91
273
274If you intend to run only on FAT (or if using AnyDBM_File on FAT),
275run Configure with the -Ui_ndbm and -Ui_dbm options to prevent
276NDBM_File and ODBM_File being built.
277
278With NTFS (and no CYGWIN=nontsec), there should be no problems even if
279perl was built on FAT.
280
281=head2 C<fork()> failures in io_* tests
282
283A C<fork()> failure may result in the following tests failing:
284
285  ext/IO/lib/IO/t/io_multihomed.t
286  ext/IO/lib/IO/t/io_sock.t
287  ext/IO/lib/IO/t/io_unix.t
288
289See comment on fork in L</Miscellaneous> below.
290
291=head1 Specific features of the Cygwin port
292
293=head2 Script Portability on Cygwin
294
295Cygwin does an outstanding job of providing UNIX-like semantics on top of
296Win32 systems.  However, in addition to the items noted above, there are
297some differences that you should know about.  This is a very brief guide
298to portability, more information can be found in the Cygwin documentation.
299
300=over 4
301
302=item * Pathnames
303
304Cygwin pathnames are separated by forward (F</>) slashes, Universal
305Naming Codes (F<//UNC>) are also supported.  Since cygwin-1.7 non-POSIX
306pathnames should not be used.  Names may contain all printable
307characters.
308
309File names are case insensitive, but case preserving.  A pathname that
310contains a backslash or drive letter is a Win32 pathname, and not
311subject to the translations applied to POSIX style pathnames, but
312cygwin will warn you, so better convert them to POSIX.
313
314For conversion we have C<Cygwin::win_to_posix_path()> and
315C<Cygwin::posix_to_win_path()>.
316
317Since cygwin-1.7 pathnames are UTF-8 encoded.
318
319=item * Text/Binary
320
321Since cygwin-1.7 textmounts are deprecated and strongly discouraged.
322
323When a file is opened it is in either text or binary mode.  In text mode
324a file is subject to CR/LF/Ctrl-Z translations.  With Cygwin, the default
325mode for an C<open()> is determined by the mode of the mount that underlies
326the file. See L</Cygwin::is_binmount>(). Perl provides a C<binmode()> function
327to set binary mode on files that otherwise would be treated as text.
328C<sysopen()> with the C<O_TEXT> flag sets text mode on files that otherwise
329would be treated as binary:
330
331    sysopen(FOO, "bar", O_WRONLY|O_CREAT|O_TEXT)
332
333C<lseek()>, C<tell()> and C<sysseek()> only work with files opened in binary
334mode.
335
336The text/binary issue is covered at length in the Cygwin documentation.
337
338=item * PerlIO
339
340PerlIO overrides the default Cygwin Text/Binary behaviour.  A file will
341always be treated as binary, regardless of the mode of the mount it lives
342on, just like it is in UNIX.  So CR/LF translation needs to be requested in
343either the C<open()> call like this:
344
345  open(FH, ">:crlf", "out.txt");
346
347which will do conversion from LF to CR/LF on the output, or in the
348environment settings (add this to your .bashrc):
349
350  export PERLIO=crlf
351
352which will pull in the crlf PerlIO layer which does LF -> CRLF conversion
353on every output generated by perl.
354
355=item * F<.exe>
356
357The Cygwin C<stat()>, C<lstat()> and C<readlink()> functions make the F<.exe>
358extension transparent by looking for F<foo.exe> when you ask for F<foo>
359(unless a F<foo> also exists).  Cygwin does not require a F<.exe>
360extension, but I<gcc> adds it automatically when building a program.
361However, when accessing an executable as a normal file (e.g., I<cp>
362in a makefile) the F<.exe> is not transparent.  The I<install> program
363included with Cygwin automatically appends a F<.exe> when necessary.
364
365=item * Cygwin vs. Windows process ids
366
367Cygwin processes have their own pid, which is different from the
368underlying windows pid.  Most posix compliant Proc functions expect
369the cygwin pid, but several Win32::Process functions expect the
370winpid. E.g. C<$$> is the cygwin pid of F</usr/bin/perl>, which is not
371the winpid.  Use C<Cygwin::pid_to_winpid()> and C<Cygwin::winpid_to_pid()>
372to translate between them.
373
374=item * Cygwin vs. Windows errors
375
376Under Cygwin, $^E is the same as $!.  When using L<Win32 API Functions|Win32>,
377use C<Win32::GetLastError()> to get the last Windows error.
378
379=item * rebase errors on fork or system
380
381Using C<fork()> or C<system()> out to another perl after loading multiple dlls
382may result on a DLL baseaddress conflict. The internal cygwin error
383looks like like the following:
384
385 0 [main] perl 8916 child_info_fork::abort: data segment start:
386 parent (0xC1A000) != child(0xA6A000)
387
388or:
389
390 183 [main] perl 3588 C:\cygwin\bin\perl.exe: *** fatal error -
391 unable to remap C:\cygwin\bin\cygsvn_subr-1-0.dll to same address
392 as parent(0x6FB30000) != 0x6FE60000 46 [main] perl 3488 fork: child
393 3588 - died waiting for dll loading, errno11
394
395See L<https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures>
396It helps if not too many DLLs are loaded in memory so the available address space is larger,
397e.g. stopping the MS Internet Explorer might help.
398
399+Use the rebase utilities to resolve the conflicting dll addresses.
400The rebase package is included in the Cygwin setup. Use F<setup.exe>
401from L<https://cygwin.com/install.html> to install it.
402
4031. kill all perl processes and run
404   C<</bin/find <dir> -xdev -name \*.dll | /bin/rebase -OT ->> or
405
4062. kill all cygwin processes and services, and run setup.exe.
407
408=item * Miscellaneous
409
410File locking using the C<F_GETLK> command to C<fcntl()> is a stub that
411returns C<ENOSYS>.
412
413The Cygwin C<chroot()> implementation has holes (it can not restrict file
414access by native Win32 programs).
415
416Inplace editing C<perl -i> of files doesn't work without doing a backup
417of the file being edited C<perl -i.bak> because of windowish restrictions,
418therefore Perl adds the suffix C<.bak> automatically if you use C<perl -i>
419without specifying a backup extension.
420
421=back
422
423=head2 Prebuilt methods:
424
425=over 4
426
427=item C<Cwd::cwd>
428
429Returns the current working directory.
430
431=item C<Cygwin::pid_to_winpid>
432
433Translates a cygwin pid to the corresponding Windows pid (which may or
434may not be the same).
435
436=item C<Cygwin::winpid_to_pid>
437
438Translates a Windows pid to the corresponding cygwin pid (if any).
439
440=item C<Cygwin::win_to_posix_path>
441
442Translates a Windows path to the corresponding cygwin path respecting
443the current mount points. With a second non-null argument returns an
444absolute path. Double-byte characters will not be translated.
445
446=item C<Cygwin::posix_to_win_path>
447
448Translates a cygwin path to the corresponding cygwin path respecting
449the current mount points. With a second non-null argument returns an
450absolute path. Double-byte characters will not be translated.
451
452=item C<Cygwin::mount_table()>
453
454Returns an array of [mnt_dir, mnt_fsname, mnt_type, mnt_opts].
455
456  perl -e 'for $i (Cygwin::mount_table) {print join(" ",@$i),"\n";}'
457  /bin c:\cygwin\bin system binmode,cygexec
458  /usr/bin c:\cygwin\bin system binmode
459  /usr/lib c:\cygwin\lib system binmode
460  / c:\cygwin system binmode
461  /cygdrive/c c: system binmode,noumount
462  /cygdrive/d d: system binmode,noumount
463  /cygdrive/e e: system binmode,noumount
464
465=item C<Cygwin::mount_flags>
466
467Returns the mount type and flags for a specified mount point.
468A comma-separated string of mntent->mnt_type (always
469"system" or "user"), then the mntent->mnt_opts, where
470the first is always "binmode" or "textmode".
471
472  system|user,binmode|textmode,exec,cygexec,cygdrive,mixed,
473  notexec,managed,nosuid,devfs,proc,noumount
474
475If the argument is "/cygdrive", then just the volume mount settings,
476and the cygdrive mount prefix are returned.
477
478User mounts override system mounts.
479
480  $ perl -e 'print Cygwin::mount_flags "/usr/bin"'
481  system,binmode,cygexec
482  $ perl -e 'print Cygwin::mount_flags "/cygdrive"'
483  binmode,cygdrive,/cygdrive
484
485=item C<Cygwin::is_binmount>
486
487Returns true if the given cygwin path is binary mounted, false if the
488path is mounted in textmode.
489
490=item C<Cygwin::sync_winenv>
491
492Cygwin does not initialize all original Win32 environment variables.
493See the bottom of this page L<https://cygwin.com/cygwin-ug-net/setup-env.html>
494for "Restricted Win32 environment".
495
496Certain Win32 programs called from cygwin programs might need some environment
497variable, such as e.g. ADODB needs %COMMONPROGRAMFILES%.
498Call Cygwin::sync_winenv() to copy all Win32 environment variables to your
499process and note that cygwin will warn on every encounter of non-POSIX paths.
500
501=back
502
503=head1 INSTALL PERL ON CYGWIN
504
505This will install Perl, including I<man> pages.
506
507  make install 2>&1 | tee log.make-install
508
509NOTE: If C<STDERR> is redirected C<make install> will B<not> prompt
510you to install I<perl> into F</usr/bin>.
511
512You may need to be I<Administrator> to run C<make install>.  If you
513are not, you must have write access to the directories in question.
514
515Information on installing the Perl documentation in HTML format can be
516found in the F<INSTALL> document.
517
518=head1 MANIFEST ON CYGWIN
519
520These are the files in the Perl release that contain references to Cygwin.
521These very brief notes attempt to explain the reason for all conditional
522code.  Hopefully, keeping this up to date will allow the Cygwin port to
523be kept as clean as possible.
524
525=over 4
526
527=item Documentation
528
529 INSTALL README.cygwin README.win32 MANIFEST
530 pod/perl.pod pod/perlport.pod pod/perlfaq3.pod
531 pod/perldelta.pod pod/perl5004delta.pod pod/perl56delta.pod
532 pod/perl561delta.pod pod/perl570delta.pod pod/perl572delta.pod
533 pod/perl573delta.pod pod/perl58delta.pod pod/perl581delta.pod
534 pod/perl590delta.pod pod/perlhist.pod pod/perlmodlib.pod
535 pod/perltoc.pod Porting/Glossary pod/perlgit.pod
536 Porting/updateAUTHORS.pl
537 dist/Cwd/Changes ext/Compress-Raw-Zlib/Changes
538 dist/Time-HiRes/Changes
539 ext/Compress-Raw-Zlib/README ext/Compress-Zlib/Changes
540 ext/DB_File/Changes ext/Encode/Changes ext/Sys-Syslog/Changes
541 ext/Win32API-File/Changes
542 lib/ExtUtils/CBuilder/Changes lib/ExtUtils/Changes
543 lib/ExtUtils/NOTES lib/ExtUtils/PATCHING lib/ExtUtils/README
544 lib/Net/Ping/Changes lib/Test/Harness/Changes
545 lib/Term/ANSIColor/ChangeLog lib/Term/ANSIColor/README
546
547=item Build, Configure, Make, Install
548
549 cygwin/Makefile.SHs
550 ext/IPC/SysV/hints/cygwin.pl
551 ext/NDBM_File/hints/cygwin.pl
552 ext/ODBM_File/hints/cygwin.pl
553 hints/cygwin.sh
554 Configure             - help finding hints from uname,
555                         shared libperl required for dynamic loading
556 Makefile.SH Cross/Makefile-cross-SH
557                       - linklibperl
558 Porting/patchls       - cygwin in port list
559 installman            - man pages with :: translated to .
560 installperl           - install dll, install to 'pods'
561 makedepend.SH         - uwinfix
562 regen_lib.pl          - file permissions
563
564 plan9/mkfile
565 vms/descrip_mms.template
566 win32/Makefile
567
568=item Tests
569
570 t/io/fs.t             - no file mode checks if not ntsec
571                         skip rename() check when not
572                         check_case:relaxed
573 t/io/tell.t           - binmode
574 t/lib/cygwin.t        - builtin cygwin function tests
575 t/op/groups.t         - basegroup has ID = 0
576 t/op/magic.t          - $^X/symlink WORKAROUND, s/.exe//
577 t/op/stat.t           - no /dev, skip Win32 ftCreationTime quirk
578                         (cache manager sometimes preserves ctime of
579                         file previously created and deleted), no -u
580                         (setuid)
581 t/op/taint.t          - can't use empty path under Cygwin Perl
582 t/op/time.t           - no tzset()
583
584=item Compiled Perl Source
585
586 EXTERN.h              - __declspec(dllimport)
587 XSUB.h                - __declspec(dllexport)
588 cygwin/cygwin.c       - os_extras (getcwd, spawn, and several
589                         Cygwin:: functions)
590 perl.c                - os_extras, -i.bak
591 perl.h                - binmode
592 doio.c                - win9x can not rename a file when it is open
593 pp_sys.c              - do not define h_errno, init
594                         _pwent_struct.pw_comment
595 util.c                - use setenv
596 util.h                - PERL_FILE_IS_ABSOLUTE macro
597 pp.c                  - Comment about Posix vs IEEE math under
598                         Cygwin
599 perlio.c              - CR/LF mode
600 perliol.c             - Comment about EXTCONST under Cygwin
601
602=item Compiled Module Source
603
604 ext/Compress-Raw-Zlib/Makefile.PL
605                       - Can't install via CPAN shell under Cygwin
606 ext/Compress-Raw-Zlib/zlib-src/zutil.h
607                       - Cygwin is Unix-like and has vsnprintf
608 ext/Errno/Errno_pm.PL - Special handling for Win32 Perl under
609                         Cygwin
610 ext/POSIX/POSIX.xs    - tzname defined externally
611 ext/SDBM_File/sdbm/pair.c
612                       - EXTCONST needs to be redefined from
613                         EXTERN.h
614 ext/SDBM_File/sdbm/sdbm.c
615                       - binary open
616 ext/Sys/Syslog/Syslog.xs
617                       - Cygwin has syslog.h
618 ext/Sys/Syslog/win32/compile.pl
619                       - Convert paths to Windows paths
620 ext/Time-HiRes/HiRes.xs
621                       - Various timers not available
622 ext/Time-HiRes/Makefile.PL
623                       - Find w32api/windows.h
624 ext/Win32/Makefile.PL - Use various libraries under Cygwin
625 ext/Win32/Win32.xs    - Child dir and child env under Cygwin
626 ext/Win32API-File/File.xs
627                       - _open_osfhandle not implemented under
628                         Cygwin
629 ext/Win32CORE/Win32CORE.c
630                       - __declspec(dllexport)
631
632=item Perl Modules/Scripts
633
634 ext/B/t/OptreeCheck.pm - Comment about stderr/stdout order under
635                          Cygwin
636 ext/Digest-SHA/bin/shasum
637                       - Use binary mode under Cygwin
638 ext/Sys/Syslog/win32/Win32.pm
639                       - Convert paths to Windows paths
640 ext/Time-HiRes/HiRes.pm
641                       - Comment about various timers not available
642 ext/Win32API-File/File.pm
643                       - _open_osfhandle not implemented under
644                         Cygwin
645 ext/Win32CORE/Win32CORE.pm
646                       - History of Win32CORE under Cygwin
647 lib/Cwd.pm            - hook to internal Cwd::cwd
648 lib/ExtUtils/CBuilder/Platform/cygwin.pm
649                       - use gcc for ld, and link to libperl.dll.a
650 lib/ExtUtils/CBuilder.pm
651                       - Cygwin is Unix-like
652 lib/ExtUtils/Install.pm - Install and rename issues under Cygwin
653 lib/ExtUtils/MM.pm    - OS classifications
654 lib/ExtUtils/MM_Any.pm - Example for Cygwin
655 lib/ExtUtils/MakeMaker.pm
656                       - require MM_Cygwin.pm
657 lib/ExtUtils/MM_Cygwin.pm
658                       - canonpath, cflags, manifypods, perl_archive
659 lib/File/Fetch.pm     - Comment about quotes using a Cygwin example
660 lib/File/Find.pm      - on remote drives stat() always sets
661                         st_nlink to 1
662 lib/File/Spec/Cygwin.pm - case_tolerant
663 lib/File/Spec/Unix.pm - preserve //unc
664 lib/File/Spec/Win32.pm - References a message on cygwin.com
665 lib/File/Spec.pm      - Pulls in lib/File/Spec/Cygwin.pm
666 lib/File/Temp.pm      - no directory sticky bit
667 lib/Module/CoreList.pm - List of all module files and versions
668 lib/Net/Domain.pm     - No domainname command under Cygwin
669 lib/Net/Netrc.pm      - Bypass using stat() under Cygwin
670 lib/Net/Ping.pm       - ECONREFUSED is EAGAIN under Cygwin
671 lib/Pod/Find.pm       - Set 'pods' dir
672 lib/Pod/Perldoc/ToMan.pm - '-c' switch for pod2man
673 lib/Pod/Perldoc.pm    - Use 'less' pager, and use .exe extension
674 lib/Term/ANSIColor.pm - Cygwin terminal info
675 lib/perl5db.pl        - use stdin not /dev/tty
676 utils/perlbug.PL      - Add CYGWIN environment variable to report
677
678=item Perl Module Tests
679
680 dist/Cwd/t/cwd.t
681 ext/Compress-Zlib/t/14gzopen.t
682 ext/DB_File/t/db-btree.t
683 ext/DB_File/t/db-hash.t
684 ext/DB_File/t/db-recno.t
685 ext/DynaLoader/t/DynaLoader.t
686 ext/File-Glob/t/basic.t
687 ext/GDBM_File/t/gdbm.t
688 ext/POSIX/t/sysconf.t
689 ext/POSIX/t/time.t
690 ext/SDBM_File/t/sdbm.t
691 ext/Sys/Syslog/t/syslog.t
692 ext/Time-HiRes/t/HiRes.t
693 ext/Win32/t/Unicode.t
694 ext/Win32API-File/t/file.t
695 ext/Win32CORE/t/win32core.t
696 lib/AnyDBM_File.t
697 lib/Archive/Extract/t/01_Archive-Extract.t
698 lib/Archive/Tar/t/02_methods.t
699 lib/ExtUtils/t/Embed.t
700 lib/ExtUtils/t/eu_command.t
701 lib/ExtUtils/t/MM_Cygwin.t
702 lib/ExtUtils/t/MM_Unix.t
703 lib/File/Compare.t
704 lib/File/Copy.t
705 lib/File/Find/t/find.t
706 lib/File/Path.t
707 lib/File/Spec/t/crossplatform.t
708 lib/File/Spec/t/Spec.t
709 lib/Net/hostent.t
710 lib/Net/Ping/t/110_icmp_inst.t
711 lib/Net/Ping/t/500_ping_icmp.t
712 lib/Net/t/netrc.t
713 lib/Pod/Simple/t/perlcyg.pod
714 lib/Pod/Simple/t/perlcygo.txt
715 lib/Pod/Simple/t/perlfaq.pod
716 lib/Pod/Simple/t/perlfaqo.txt
717 lib/User/grent.t
718 lib/User/pwent.t
719
720=back
721
722=head1 BUGS ON CYGWIN
723
724Support for swapping real and effective user and group IDs is incomplete.
725On WinNT Cygwin provides C<setuid()>, C<seteuid()>, C<setgid()> and C<setegid()>.
726However, additional Cygwin calls for manipulating WinNT access tokens
727and security contexts are required.
728
729=head1 AUTHORS
730
731Charles Wilson <cwilson@ece.gatech.edu>,
732Eric Fifer <egf7@columbia.edu>,
733alexander smishlajev <als@turnhere.com>,
734Steven Morlock <newspost@morlock.net>,
735Sebastien Barre <Sebastien.Barre@utc.fr>,
736Teun Burgers <burgers@ecn.nl>,
737Gerrit P. Haase <gp@familiehaase.de>,
738Reini Urban <rurban@cpan.org>,
739Jan Dubois <jand@activestate.com>,
740Jerry D. Hedden <jdhedden@cpan.org>.
741
742=head1 HISTORY
743
744Last updated: 2019-11-14
745

README.freebsd

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see.  It is written in the POD format (see pod/perlpod.pod) which is
5specifically designed to be readable as is.
6
7=head1 NAME
8
9perlfreebsd - Perl version 5 on FreeBSD systems
10
11=head1 DESCRIPTION
12
13This document describes various features of FreeBSD that will affect how Perl
14version 5 (hereafter just Perl) is compiled and/or runs.
15
16=head2 FreeBSD core dumps from readdir_r with ithreads
17
18When perl is configured to use ithreads, it will use re-entrant library calls
19in preference to non-re-entrant versions.  There is a bug in FreeBSD's
20C<readdir_r> function in versions 4.5 and earlier that can cause a SEGV when
21reading large directories. A patch for FreeBSD libc is available
22(see L<https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=30631>)
23which has been integrated into FreeBSD 4.6.
24
25=head2 C<$^X> doesn't always contain a full path in FreeBSD
26
27perl sets C<$^X> where possible to a full path by asking the operating
28system. On FreeBSD the full path of the perl interpreter is found by using
29C<sysctl> with C<KERN_PROC_PATHNAME> if that is supported, else by reading
30the symlink F</proc/curproc/file>. FreeBSD 7 and earlier has a bug where
31either approach sometimes returns an incorrect value
32(see L<https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=35703>).
33In these cases perl will fall back to the old behaviour of using C's
34C<argv[0]> value for C<$^X>.
35
36=head1 AUTHOR
37
38Nicholas Clark <nick@ccl4.org>, collating wisdom supplied by Slaven Rezic
39and Tim Bunce.
40
41Please report any errors, updates, or suggestions to
42L<https://github.com/Perl/perl5/issues>.
43
44

README.haiku

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlhaiku - Perl version 5.10+ on Haiku
10
11=head1 DESCRIPTION
12
13This file contains instructions how to build Perl for Haiku and lists
14known problems.
15
16=head1 BUILD AND INSTALL
17
18The build procedure is completely standard:
19
20  ./Configure -de
21  make
22  make install
23
24Make perl executable and create a symlink for libperl:
25
26  chmod a+x /boot/common/bin/perl
27  cd /boot/common/lib; ln -s perl5/5.38.2/BePC-haiku/CORE/libperl.so .
28
29Replace C<5.38.2> with your respective version of Perl.
30
31=head1 KNOWN PROBLEMS
32
33The following problems are encountered with Haiku revision 28311:
34
35=over 4
36
37=item *
38
39Perl cannot be compiled with threading support ATM.
40
41=item *
42
43The F<cpan/Socket/t/socketpair.t> test fails. More precisely: the subtests
44using datagram sockets fail. Unix datagram sockets aren't implemented in
45Haiku yet.
46
47=item *
48
49A subtest of the F<cpan/Sys-Syslog/t/syslog.t> test fails. This is due to Haiku
50not implementing F</dev/log> support yet.
51
52=item *
53
54The tests F<dist/Net-Ping/t/450_service.t> and F<dist/Net-Ping/t/510_ping_udp.t>
55fail. This is due to bugs in Haiku's network stack implementation.
56
57=back
58
59=head1 CONTACT
60
61For Haiku specific problems contact the HaikuPorts developers:
62L<http://ports.haiku-files.org/>
63
64The initial Haiku port was done by Ingo Weinhold <ingo_weinhold@gmx.de>.
65
66Last update: 2008-10-29
67

README.hpux

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlhpux - Perl version 5 on Hewlett-Packard Unix (HP-UX) systems
10
11=head1 DESCRIPTION
12
13This document describes various features of HP's Unix operating system
14(HP-UX) that will affect how Perl version 5 (hereafter just Perl) is
15compiled and/or runs.
16
17=head2 Using perl as shipped with HP-UX
18
19Application release September 2001, HP-UX 11.00 is the first to ship
20with Perl. By the time it was perl-5.6.1 in /opt/perl. The first
21occurrence is on CD 5012-7954 and can be installed using
22
23  swinstall -s /cdrom perl
24
25assuming you have mounted that CD on /cdrom.
26
27That build was a portable hppa-1.1 multithread build that supports large
28files compiled with gcc-2.9-hppa-991112.
29
30If you perform a new installation, then (a newer) Perl will be installed
31automatically.  Pre-installed HP-UX systems now have more recent versions
32of Perl and the updated modules.
33
34The official (threaded) builds from HP, as they are shipped on the
35Application DVD/CD's are available on
36L<http://www.software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL>
37for both PA-RISC and IPF (Itanium Processor Family). They are built
38with the HP ANSI-C compiler. Up till 5.8.8 that was done by ActiveState.
39
40To see what version is included on the DVD (assumed here to be mounted
41on /cdrom), issue this command:
42
43  # swlist -s /cdrom perl
44  # perl           D.5.8.8.B  5.8.8 Perl Programming Language
45    perl.Perl5-32  D.5.8.8.B  32-bit 5.8.8 Perl Programming Language
46                                           with Extensions
47    perl.Perl5-64  D.5.8.8.B  64-bit 5.8.8 Perl Programming Language
48                                           with Extensions
49
50To see what is installed on your system:
51
52  # swlist -R perl
53  # perl                    E.5.8.8.J  Perl Programming Language
54  # perl.Perl5-32           E.5.8.8.J  32-bit Perl Programming Language
55                                       with Extensions
56    perl.Perl5-32.PERL-MAN  E.5.8.8.J  32-bit Perl Man Pages for IA
57    perl.Perl5-32.PERL-RUN  E.5.8.8.J  32-bit Perl Binaries for IA
58  # perl.Perl5-64           E.5.8.8.J  64-bit Perl Programming Language
59                                       with Extensions
60    perl.Perl5-64.PERL-MAN  E.5.8.8.J  64-bit Perl Man Pages for IA
61    perl.Perl5-64.PERL-RUN  E.5.8.8.J  64-bit Perl Binaries for IA
62
63=head2 Using perl from HP's porting centre
64
65HP porting centre tries to keep up with customer demand and release
66updates from the Open Source community. Having precompiled Perl binaries
67available is obvious, though "up-to-date" is something relative. At the
68moment of writing perl-5.10.1 and 5.28.0 were available.
69
70The HP porting centres are limited in what systems they are allowed
71to port to and they usually choose the two most recent OS versions
72available.
73
74HP has asked the porting centre to move Open Source binaries
75from /opt to /usr/local, so binaries produced since the start
76of July 2002 are located in /usr/local.
77
78One of HP porting centres URL's is L<http://hpux.connect.org.uk/>
79The port currently available is built with GNU gcc. As porting modern
80GNU gcc is extremely hard on HP-UX, they are stuck at version gcc-4.2.3.
81
82=head2 Other prebuilt perl binaries
83
84To get more perl depots for the whole range of HP-UX, visit
85H.Merijn Brand's site at L<http://mirrors.develooper.com/hpux/#Perl>.
86Carefully read the notes to see if the available versions suit your needs.
87
88=head2 Compiling Perl 5 on HP-UX
89
90When compiling Perl, you must use an ANSI C compiler.  The C compiler
91that ships with all HP-UX systems is a K&R compiler that should only be
92used to build new kernels.
93
94Perl can be compiled with either HP's ANSI C compiler or with gcc.  The
95former is recommended, as not only can it compile Perl with no
96difficulty, but also can take advantage of features listed later that
97require the use of HP compiler-specific command-line flags.
98
99If you decide to use gcc, make sure your installation is recent and
100complete, and be sure to read the Perl INSTALL file for more gcc-specific
101details.
102
103=head2 PA-RISC
104
105The last and final version of PA-RISC is 2.0, HP no longer sells any
106system with these CPU's.
107
108HP's HP9000 Unix systems run on HP's own Precision Architecture
109(PA-RISC) chip.  HP-UX used to run on the Motorola MC68000 family of
110chips, but any machine with this chip in it is quite obsolete and this
111document will not attempt to address issues for compiling Perl on the
112Motorola chipset. Even though PA-RISC hardware is not sold anymore, a
113lot of machines still running on these CPU's can be found in the wild.
114
115The last order date for HP 9000 systems was December 31, 2008.
116
117HP PA-RISC systems are usually referred to with model description "HP 9000".
118The last CPU in this series is the PA-8900.  Support for PA-RISC
119architectured machines officially ended as shown in the following table:
120
121   PA-RISC End-of-Life Roadmap
122 +--------+----------------+----------------+-----------------+
123 | HP9000 | Superdome      | PA-8700        | Spring 2011     |
124 | 4-128  |                | PA-8800/sx1000 | Summer 2012     |
125 | cores  |                | PA-8900/sx1000 | 2014            |
126 |        |                | PA-8900/sx2000 | 2015            |
127 +--------+----------------+----------------+-----------------+
128 | HP9000 | rp7410, rp8400 | PA-8700        | Spring 2011     |
129 | 2-32   | rp7420, rp8420 | PA-8800/sx1000 | 2012            |
130 | cores  | rp7440, rp8440 | PA-8900/sx1000 | Autumn 2013     |
131 |        |                | PA-8900/sx2000 | 2015            |
132 +--------+----------------+----------------+-----------------+
133 | HP9000 | rp44x0         | PA-8700        | Spring 2011     |
134 | 1-8    |                | PA-8800/rp44x0 | 2012            |
135 | cores  |                | PA-8900/rp44x0 | 2014            |
136 +--------+----------------+----------------+-----------------+
137 | HP9000 | rp34x0         | PA-8700        | Spring 2011     |
138 | 1-4    |                | PA-8800/rp34x0 | 2012            |
139 | cores  |                | PA-8900/rp34x0 | 2014            |
140 +--------+----------------+----------------+-----------------+
141
142A complete list of models at the time the OS was built is in the file
143/usr/sam/lib/mo/sched.models. The first column corresponds to the last
144part of the output of the "model" command.  The second column is the
145PA-RISC version and the third column is the exact chip type used.
146(Start browsing at the bottom to prevent confusion ;-)
147
148  # model
149  9000/800/L1000-44
150  # grep L1000-44 /usr/sam/lib/mo/sched.models
151  L1000-44        2.0     PA8500
152
153=head2 PA-RISC 1.0
154
155The original version of PA-RISC, HP no longer sells any system with this chip.
156
157The following systems contained PA-RISC 1.0 chips:
158
159  600, 635, 645, 808, 815, 822, 825, 832, 834, 835, 840, 842, 845, 850,
160  852, 855, 860, 865, 870, 890
161
162=head2 PA-RISC 1.1
163
164An upgrade to the PA-RISC design, it shipped for many years in many different
165system.
166
167The following systems contain with PA-RISC 1.1 chips:
168
169  705, 710, 712, 715, 720, 722, 725, 728, 730, 735, 742, 743, 744, 745,
170  747, 750, 755, 770, 777, 778, 779, 800, 801, 803, 806, 807, 809, 811,
171  813, 816, 817, 819, 821, 826, 827, 829, 831, 837, 839, 841, 847, 849,
172  851, 856, 857, 859, 867, 869, 877, 887, 891, 892, 897, A180, A180C,
173  B115, B120, B132L, B132L+, B160L, B180L, C100, C110, C115, C120,
174  C160L, D200, D210, D220, D230, D250, D260, D310, D320, D330, D350,
175  D360, D410, DX0, DX5, DXO, E25, E35, E45, E55, F10, F20, F30, G30,
176  G40, G50, G60, G70, H20, H30, H40, H50, H60, H70, I30, I40, I50, I60,
177  I70, J200, J210, J210XC, K100, K200, K210, K220, K230, K400, K410,
178  K420, S700i, S715, S744, S760, T500, T520
179
180=head2 PA-RISC 2.0
181
182The most recent upgrade to the PA-RISC design, it added support for
18364-bit integer data.
184
185As of the date of this document's last update, the following systems
186contain PA-RISC 2.0 chips:
187
188  700, 780, 781, 782, 783, 785, 802, 804, 810, 820, 861, 871, 879, 889,
189  893, 895, 896, 898, 899, A400, A500, B1000, B2000, C130, C140, C160,
190  C180, C180+, C180-XP, C200+, C400+, C3000, C360, C3600, CB260, D270,
191  D280, D370, D380, D390, D650, J220, J2240, J280, J282, J400, J410,
192  J5000, J5500XM, J5600, J7000, J7600, K250, K260, K260-EG, K270, K360,
193  K370, K380, K450, K460, K460-EG, K460-XP, K470, K570, K580, L1000,
194  L2000, L3000, N4000, R380, R390, SD16000, SD32000, SD64000, T540,
195  T600, V2000, V2200, V2250, V2500, V2600
196
197Just before HP took over Compaq, some systems were renamed. the link
198that contained the explanation is dead, so here's a short summary:
199
200  HP 9000 A-Class servers, now renamed HP Server rp2400 series.
201  HP 9000 L-Class servers, now renamed HP Server rp5400 series.
202  HP 9000 N-Class servers, now renamed HP Server rp7400.
203
204  rp2400, rp2405, rp2430, rp2450, rp2470, rp3410, rp3440, rp4410,
205  rp4440, rp5400, rp5405, rp5430, rp5450, rp5470, rp7400, rp7405,
206  rp7410, rp7420, rp7440, rp8400, rp8420, rp8440, Superdome
207
208The current naming convention is:
209
210  aadddd
211  ||||`+- 00 - 99 relative capacity & newness (upgrades, etc.)
212  |||`--- unique number for each architecture to ensure different
213  |||     systems do not have the same numbering across
214  |||     architectures
215  ||`---- 1 - 9 identifies family and/or relative positioning
216  ||
217  |`----- c = ia32 (cisc)
218  |       p = pa-risc
219  |       x = ia-64 (Itanium & Itanium 2)
220  |       h = housing
221  `------ t = tower
222          r = rack optimized
223          s = super scalable
224          b = blade
225          sa = appliance
226
227=head2 Portability Between PA-RISC Versions
228
229An executable compiled on a PA-RISC 2.0 platform will not execute on a
230PA-RISC 1.1 platform, even if they are running the same version of
231HP-UX.  If you are building Perl on a PA-RISC 2.0 platform and want that
232Perl to also run on a PA-RISC 1.1, the compiler flags +DAportable and
233+DS32 should be used.
234
235It is no longer possible to compile PA-RISC 1.0 executables on either
236the PA-RISC 1.1 or 2.0 platforms.  The command-line flags are accepted,
237but the resulting executable will not run when transferred to a PA-RISC
2381.0 system.
239
240=head2 Itanium Processor Family (IPF) and HP-UX
241
242HP-UX also runs on the newer Itanium processor.  This requires the use
243of HP-UX version 11.23 (11i v2) or 11.31 (11i v3), and with the exception
244of a few differences detailed below and in later sections, Perl should
245compile with no problems.
246
247Although PA-RISC binaries can run on Itanium systems, you should not
248attempt to use a PA-RISC version of Perl on an Itanium system.  This is
249because shared libraries created on an Itanium system cannot be loaded
250while running a PA-RISC executable.
251
252HP Itanium 2 systems are usually referred to with model description
253"HP Integrity".
254
255=head2 Itanium, Itanium 2 & Madison 6
256
257HP also ships servers with the 128-bit Itanium processor(s). The cx26x0
258is told to have Madison 6. As of the date of this document's last update,
259the following systems contain Itanium or Itanium 2 chips (this is likely
260to be out of date):
261
262  BL60p, BL860c, BL870c, BL890c, cx2600, cx2620, rx1600, rx1620, rx2600,
263  rx2600hptc, rx2620, rx2660, rx2800, rx3600, rx4610, rx4640, rx5670,
264  rx6600, rx7420, rx7620, rx7640, rx8420, rx8620, rx8640, rx9610,
265  sx1000, sx2000
266
267To see all about your machine, type
268
269  # model
270  ia64 hp server rx2600
271  # /usr/contrib/bin/machinfo
272
273=head2 HP-UX versions
274
275Not all architectures (PA = PA-RISC, IPF = Itanium Processor Family)
276support all versions of HP-UX, here is a short list
277
278  HP-UX version  Kernel  Architecture End-of-factory support
279  -------------  ------  ------------ ----------------------------------
280  10.20          32 bit  PA           30-Jun-2003
281  11.00          32/64   PA           31-Dec-2006
282  11.11  11i v1  32/64   PA           31-Dec-2015
283  11.22  11i v2     64        IPF     30-Apr-2004
284  11.23  11i v2     64   PA & IPF     31-Dec-2015
285  11.31  11i v3     64   PA & IPF     31-Dec-2020 (PA) 31-Dec-2025 (IPF)
286
287See for the full list of hardware/OS support and expected end-of-life
288L<https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>
289
290=head2 Building Dynamic Extensions on HP-UX
291
292HP-UX supports dynamically loadable libraries (shared libraries).
293Shared libraries end with the suffix .sl.  On Itanium systems,
294they end with the suffix .so.
295
296Shared libraries created on a platform using a particular PA-RISC
297version are not usable on platforms using an earlier PA-RISC version by
298default.  However, this backwards compatibility may be enabled using the
299same +DAportable compiler flag (with the same PA-RISC 1.0 caveat
300mentioned above).
301
302Shared libraries created on an Itanium platform cannot be loaded on
303a PA-RISC platform.  Shared libraries created on a PA-RISC platform
304can only be loaded on an Itanium platform if it is a PA-RISC executable
305that is attempting to load the PA-RISC library.  A PA-RISC shared
306library cannot be loaded into an Itanium executable nor vice-versa.
307
308To create a shared library, the following steps must be performed:
309
310  1. Compile source modules with +z or +Z flag to create a .o module
311     which contains Position-Independent Code (PIC).  The linker will
312     tell you in the next step if +Z was needed.
313     (For gcc, the appropriate flag is -fpic or -fPIC.)
314
315  2. Link the shared library using the -b flag.  If the code calls
316     any functions in other system libraries (e.g., libm), it must
317     be included on this line.
318
319(Note that these steps are usually handled automatically by the extension's
320Makefile).
321
322If these dependent libraries are not listed at shared library creation
323time, you will get fatal "Unresolved symbol" errors at run time when the
324library is loaded.
325
326You may create a shared library that refers to another library, which
327may be either an archive library or a shared library.  If this second
328library is a shared library, this is called a "dependent library".  The
329dependent library's name is recorded in the main shared library, but it
330is not linked into the shared library.  Instead, it is loaded when the
331main shared library is loaded.  This can cause problems if you build an
332extension on one system and move it to another system where the
333libraries may not be located in the same place as on the first system.
334
335If the referred library is an archive library, then it is treated as a
336simple collection of .o modules (all of which must contain PIC).  These
337modules are then linked into the shared library.
338
339Note that it is okay to create a library which contains a dependent
340library that is already linked into perl.
341
342Some extensions, like DB_File and Compress::Zlib use/require prebuilt
343libraries for the perl extensions/modules to work. If these libraries
344are built using the default configuration, it might happen that you
345run into an error like "invalid loader fixup" during load phase.
346HP is aware of this problem.  Search the HP-UX cxx-dev forums for
347discussions about the subject.  The short answer is that B<everything>
348(all libraries, everything) must be compiled with C<+z> or C<+Z> to be
349PIC (position independent code).  (For gcc, that would be
350C<-fpic> or C<-fPIC>).  In HP-UX 11.00 or newer the linker
351error message should tell the name of the offending object file.
352
353A more general approach is to intervene manually, as with an example for
354the DB_File module, which requires SleepyCat's libdb.sl:
355
356  # cd .../db-3.2.9/build_unix
357  # vi Makefile
358  ... add +Z to all cflags to create shared objects
359  CFLAGS=         -c $(CPPFLAGS) +Z -Ae +O2 +Onolimit \
360                  -I/usr/local/include -I/usr/include/X11R6
361  CXXFLAGS=       -c $(CPPFLAGS) +Z -Ae +O2 +Onolimit \
362                  -I/usr/local/include -I/usr/include/X11R6
363
364  # make clean
365  # make
366  # mkdir tmp
367  # cd tmp
368  # ar x ../libdb.a
369  # ld -b -o libdb-3.2.sl *.o
370  # mv libdb-3.2.sl /usr/local/lib
371  # rm *.o
372  # cd /usr/local/lib
373  # rm -f libdb.sl
374  # ln -s libdb-3.2.sl libdb.sl
375
376  # cd .../DB_File-1.76
377  # make distclean
378  # perl Makefile.PL
379  # make
380  # make test
381  # make install
382
383As of db-4.2.x it is no longer needed to do this by hand. Sleepycat
384has changed the configuration process to add +z on HP-UX automatically.
385
386  # cd .../db-4.2.25/build_unix
387  # env CFLAGS=+DD64 LDFLAGS=+DD64 ../dist/configure
388
389should work to generate 64bit shared libraries for HP-UX 11.00 and 11i.
390
391It is no longer possible to link PA-RISC 1.0 shared libraries (even
392though the command-line flags are still present).
393
394PA-RISC and Itanium object files are not interchangeable.  Although
395you may be able to use ar to create an archive library of PA-RISC
396object files on an Itanium system, you cannot link against it using
397an Itanium link editor.
398
399=head2 The HP ANSI C Compiler
400
401When using this compiler to build Perl, you should make sure that the
402flag -Aa is added to the cpprun and cppstdin variables in the config.sh
403file (though see the section on 64-bit perl below). If you are using a
404recent version of the Perl distribution, these flags are set automatically.
405
406Even though HP-UX 10.20 and 11.00 are not actively maintained by HP
407anymore, updates for the HP ANSI C compiler are still available from
408time to time, and it might be advisable to see if updates are applicable.
409At the moment of writing, the latests available patches for 11.00 that
410should be applied are PHSS_35098, PHSS_35175, PHSS_35100, PHSS_33036,
411and PHSS_33902). If you have a SUM account, you can use it to search
412for updates/patches. Enter "ANSI" as keyword.
413
414=head2 The GNU C Compiler
415
416When you are going to use the GNU C compiler (gcc), and you don't have
417gcc yet, you can either build it yourself (if you feel masochistic enough)
418from the sources (available from e.g. L<http://gcc.gnu.org/mirrors.html>)
419or fetch a prebuilt binary from the HP porting center at
420L<http://hpux.connect.org.uk/hppd/cgi-bin/search?term=gcc&Search=Search>
421or from the DSPP (you need to be a member) at
422L<http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=2a08725cc2f02110725cc2f02110275d6e10RCRD&jumpid=reg_r1002_usen_c-001_title_r0001>
423(Browse through the list, because there are often multiple versions of
424the same package available).
425
426Most mentioned distributions are depots. H.Merijn Brand has made prebuilt
427gcc binaries available on L<http://mirrors.develooper.com/hpux/> and/or
428L<http://www.cmve.net/~merijn/> for HP-UX 10.20 (only 32bit), HP-UX 11.00,
429HP-UX 11.11 (HP-UX 11i v1), and HP-UX 11.23 (HP-UX 11i v2 PA-RISC) in both
43032- and 64-bit versions. For HP-UX 11.23 IPF and HP-UX 11.31 IPF depots are
431available too. The IPF versions do not need two versions of GNU gcc.
432
433On PA-RISC you need a different compiler for 32-bit applications and for
43464-bit applications. On PA-RISC, 32-bit objects and 64-bit objects do
435not mix. Period. There is no different behaviour for HP C-ANSI-C or GNU
436gcc. So if you require your perl binary to use 64-bit libraries, like
437Oracle-64bit, you MUST build a 64-bit perl.
438
439Building a 64-bit capable gcc on PA-RISC from source is possible only when
440you have the HP C-ANSI C compiler or an already working 64-bit binary of
441gcc available. Best performance for perl is achieved with HP's native
442compiler.
443
444=head2 Using Large Files with Perl on HP-UX
445
446Beginning with HP-UX version 10.20, files larger than 2GB (2^31 bytes)
447may be created and manipulated.  Three separate methods of doing this
448are available.  Of these methods, the best method for Perl is to compile
449using the -Duselargefiles flag to Configure.  This causes Perl to be
450compiled using structures and functions in which these are 64 bits wide,
451rather than 32 bits wide.  (Note that this will only work with HP's ANSI
452C compiler.  If you want to compile Perl using gcc, you will have to get
453a version of the compiler that supports 64-bit operations. See above for
454where to find it.)
455
456There are some drawbacks to this approach.  One is that any extension
457which calls any file-manipulating C function will need to be recompiled
458(just follow the usual "perl Makefile.PL; make; make test; make install"
459procedure).
460
461The list of functions that will need to recompiled is:
462  creat,          fgetpos,        fopen,
463  freopen,        fsetpos,        fstat,
464  fstatvfs,       fstatvfsdev,    ftruncate,
465  ftw,            lockf,          lseek,
466  lstat,          mmap,           nftw,
467  open,           prealloc,       stat,
468  statvfs,        statvfsdev,     tmpfile,
469  truncate,       getrlimit,      setrlimit
470
471Another drawback is only valid for Perl versions before 5.6.0.  This
472drawback is that the seek and tell functions (both the builtin version
473and POSIX module version) will not perform correctly.
474
475It is strongly recommended that you use this flag when you run
476Configure.  If you do not do this, but later answer the question about
477large files when Configure asks you, you may get a configuration that
478cannot be compiled, or that does not function as expected.
479
480=head2 Threaded Perl on HP-UX
481
482It is possible to compile a version of threaded Perl on any version of
483HP-UX before 10.30, but it is strongly suggested that you be running on
484HP-UX 11.00 at least.
485
486To compile Perl with threads, add -Dusethreads to the arguments of
487Configure.  Verify that the -D_POSIX_C_SOURCE=199506L compiler flag is
488automatically added to the list of flags.  Also make sure that -lpthread
489is listed before -lc in the list of libraries to link Perl with. The
490hints provided for HP-UX during Configure will try very hard to get
491this right for you.
492
493HP-UX versions before 10.30 require a separate installation of a POSIX
494threads library package. Two examples are the HP DCE package, available
495on "HP-UX Hardware Extensions 3.0, Install and Core OS, Release 10.20,
496April 1999 (B3920-13941)" or the Freely available PTH package, available
497on H.Merijn's site (L<http://mirrors.develooper.com/hpux/>). The use of PTH
498will be unsupported in perl-5.12 and up and is rather buggy in 5.11.x.
499
500If you are going to use the HP DCE package, the library used for threading
501is /usr/lib/libcma.sl, but there have been multiple updates of that
502library over time. Perl will build with the first version, but it
503will not pass the test suite. Older Oracle versions might be a compelling
504reason not to update that library, otherwise please find a newer version
505in one of the following patches: PHSS_19739, PHSS_20608, or PHSS_23672
506
507reformatted output:
508
509  d3:/usr/lib 106 > what libcma-*.1
510  libcma-00000.1:
511     HP DCE/9000 1.5               Module: libcma.sl (Export)
512                                   Date: Apr 29 1996 22:11:24
513  libcma-19739.1:
514     HP DCE/9000 1.5 PHSS_19739-40 Module: libcma.sl (Export)
515                                   Date: Sep  4 1999 01:59:07
516  libcma-20608.1:
517     HP DCE/9000 1.5 PHSS_20608    Module: libcma.1 (Export)
518                                   Date: Dec  8 1999 18:41:23
519  libcma-23672.1:
520     HP DCE/9000 1.5 PHSS_23672    Module: libcma.1 (Export)
521                                   Date: Apr  9 2001 10:01:06
522  d3:/usr/lib 107 >
523
524If you choose for the PTH package, use swinstall to install pth in
525the default location (/opt/pth), and then make symbolic links to the
526libraries from /usr/lib
527
528  # cd /usr/lib
529  # ln -s /opt/pth/lib/libpth* .
530
531For building perl to support Oracle, it needs to be linked with libcl
532and libpthread. So even if your perl is an unthreaded build, these
533libraries might be required. See "Oracle on HP-UX" below.
534
535=head2 64-bit Perl on HP-UX
536
537Beginning with HP-UX 11.00, programs compiled under HP-UX can take
538advantage of the LP64 programming environment (LP64 means Longs and
539Pointers are 64 bits wide), in which scalar variables will be able
540to hold numbers larger than 2^32 with complete precision.  Perl has
541proven to be consistent and reliable in 64bit mode since 5.8.1 on
542all HP-UX 11.xx.
543
544As of the date of this document, Perl is fully 64-bit compliant on
545HP-UX 11.00 and up for both cc- and gcc builds. If you are about to
546build a 64-bit perl with GNU gcc, please read the gcc section carefully.
547
548Should a user have the need for compiling Perl in the LP64 environment,
549use the -Duse64bitall flag to Configure.  This will force Perl to be
550compiled in a pure LP64 environment (with the +DD64 flag for HP C-ANSI-C,
551with no additional options for GNU gcc 64-bit on PA-RISC, and with
552-mlp64 for GNU gcc on Itanium).
553If you want to compile Perl using gcc, you will have to get a version of
554the compiler that supports 64-bit operations.)
555
556You can also use the -Duse64bitint flag to Configure.  Although there
557are some minor differences between compiling Perl with this flag versus
558the -Duse64bitall flag, they should not be noticeable from a Perl user's
559perspective. When configuring -Duse64bitint using a 64bit gcc on a
560pa-risc architecture, -Duse64bitint is silently promoted to -Duse64bitall.
561
562In both cases, it is strongly recommended that you use these flags when
563you run Configure.  If you do not use do this, but later answer the
564questions about 64-bit numbers when Configure asks you, you may get a
565configuration that cannot be compiled, or that does not function as
566expected.
567
568=head2 Oracle on HP-UX
569
570Using perl to connect to Oracle databases through DBI and DBD::Oracle
571has caused a lot of people many headaches. Read README.hpux in the
572DBD::Oracle for much more information. The reason to mention it here
573is that Oracle requires a perl built with libcl and libpthread, the
574latter even when perl is build without threads. Building perl using
575all defaults, but still enabling to build DBD::Oracle later on can be
576achieved using
577
578  Configure -A prepend:libswanted='cl pthread ' ...
579
580Do not forget the space before the trailing quote.
581
582Also note that this does not (yet) work with all configurations,
583it is known to fail with 64-bit versions of GCC.
584
585=head2 GDBM and Threads on HP-UX
586
587If you attempt to compile Perl with (POSIX) threads on an 11.X system
588and also link in the GDBM library, then Perl will immediately core dump
589when it starts up.  The only workaround at this point is to relink the
590GDBM library under 11.X, then relink it into Perl.
591
592the error might show something like:
593
594Pthread internal error: message: __libc_reinit() failed, file: ../pthreads/pthread.c, line: 1096
595Return Pointer is 0xc082bf33
596sh: 5345 Quit(coredump)
597
598and Configure will give up.
599
600=head2 NFS filesystems and utime(2) on HP-UX
601
602If you are compiling Perl on a remotely-mounted NFS filesystem, the test
603io/fs.t may fail on test #18.  This appears to be a bug in HP-UX and no
604fix is currently available.
605
606=head2 HP-UX Kernel Parameters (maxdsiz) for Compiling Perl
607
608By default, HP-UX comes configured with a maximum data segment size of
60964MB.  This is too small to correctly compile Perl with the maximum
610optimization levels.  You can increase the size of the maxdsiz kernel
611parameter through the use of SAM.
612
613When using the GUI version of SAM, click on the Kernel Configuration
614icon, then the Configurable Parameters icon.  Scroll down and select
615the maxdsiz line.  From the Actions menu, select the Modify Configurable
616Parameter item.  Insert the new formula into the Formula/Value box.
617Then follow the instructions to rebuild your kernel and reboot your
618system.
619
620In general, a value of 256MB (or "256*1024*1024") is sufficient for
621Perl to compile at maximum optimization.
622
623=head1 nss_delete core dump from op/pwent or op/grent
624
625You may get a bus error core dump from the op/pwent or op/grent
626tests. If compiled with -g you will see a stack trace much like
627the following:
628
629  #0  0xc004216c in  () from /usr/lib/libc.2
630  #1  0xc00d7550 in __nss_src_state_destr () from /usr/lib/libc.2
631  #2  0xc00d7768 in __nss_src_state_destr () from /usr/lib/libc.2
632  #3  0xc00d78a8 in nss_delete () from /usr/lib/libc.2
633  #4  0xc01126d8 in endpwent () from /usr/lib/libc.2
634  #5  0xd1950 in Perl_pp_epwent () from ./perl
635  #6  0x94d3c in Perl_runops_standard () from ./perl
636  #7  0x23728 in S_run_body () from ./perl
637  #8  0x23428 in perl_run () from ./perl
638  #9  0x2005c in main () from ./perl
639
640The key here is the C<nss_delete> call.  One workaround for this
641bug seems to be to create add to the file F</etc/nsswitch.conf>
642(at least) the following lines
643
644  group: files
645  passwd: files
646
647Whether you are using NIS does not matter.  Amazingly enough,
648the same bug also affects Solaris.
649
650=head1 error: pasting ")" and "l" does not give a valid preprocessing token
651
652There seems to be a broken system header file in HP-UX 11.00 that
653breaks perl building in 32bit mode with GNU gcc-4.x causing this
654error. The same file for HP-UX 11.11 (even though the file is older)
655does not show this failure, and has the correct definition, so the
656best fix is to patch the header to match:
657
658 --- /usr/include/inttypes.h  2001-04-20 18:42:14 +0200
659 +++ /usr/include/inttypes.h  2000-11-14 09:00:00 +0200
660 @@ -72,7 +72,7 @@
661  #define UINT32_C(__c)                   __CONCAT_U__(__c)
662  #else /* __LP64 */
663  #define INT32_C(__c)                    __CONCAT__(__c,l)
664 -#define UINT32_C(__c)                   __CONCAT__(__CONCAT_U__(__c),l)
665 +#define UINT32_C(__c)                   __CONCAT__(__c,ul)
666  #endif /* __LP64 */
667
668  #define INT64_C(__c)                    __CONCAT_L__(__c,l)
669
670=head1 Redeclaration of "sendpath" with a different storage class specifier
671
672The following compilation warnings may happen in HP-UX releases
673earlier than 11.31 but are harmless:
674
675 cc: "/usr/include/sys/socket.h", line 535: warning 562:
676    Redeclaration of "sendfile" with a different storage class
677    specifier: "sendfile" will have internal linkage.
678 cc: "/usr/include/sys/socket.h", line 536: warning 562:
679    Redeclaration of "sendpath" with a different storage class
680    specifier: "sendpath" will have internal linkage.
681
682They seem to be caused by broken system header files, and also other
683open source projects are seeing them.  The following HP-UX patches
684should make the warnings go away:
685
686  CR JAGae12001: PHNE_27063
687  Warning 562 on sys/socket.h due to redeclaration of prototypes
688
689  CR JAGae16787:
690  Warning 562 from socket.h sendpath/sendfile -D_FILEFFSET_BITS=64
691
692  CR JAGae73470 (11.23)
693  ER: Compiling socket.h with cc -D_FILEFFSET_BITS=64 warning 267/562
694
695=head1 Miscellaneous
696
697HP-UX 11 Y2K patch "Y2K-1100 B.11.00.B0125 HP-UX Core OS Year 2000
698Patch Bundle" has been reported to break the io/fs test #18 which
699tests whether utime() can change timestamps.  The Y2K patch seems to
700break utime() so that over NFS the timestamps do not get changed
701(on local filesystems utime() still works). This has probably been
702fixed on your system by now.
703
704=head1 AUTHOR
705
706H.Merijn Brand <h.m.brand@xs4all.nl>
707Jeff Okamoto <okamoto@corp.hp.com>
708
709With much assistance regarding shared libraries from Marc Sabatella.
710
711=cut
712

README.hurd

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlhurd - Perl version 5 on Hurd
10
11=head1 DESCRIPTION
12
13If you want to use Perl on the Hurd, I recommend using the Debian
14GNU/Hurd distribution ( see L<https://www.debian.org/> ), even if an
15official, stable release has not yet been made.  The old "gnu-0.2"
16binary distribution will most certainly have additional problems.
17
18=head2 Known Problems with Perl on Hurd
19
20The Perl test suite may still report some errors on the Hurd.  The
21"lib/anydbm" and "pragma/warnings" tests will almost certainly fail.
22Both failures are not really specific to the Hurd, as indicated by the
23test suite output.
24
25The socket tests may fail if the network is not configured.  You have
26to make "/hurd/pfinet" the translator for "/servers/socket/2", giving
27it the right arguments.  Try "/hurd/pfinet --help" for more
28information.
29
30Here are the statistics for Perl 5.005_62 on my system:
31
32 Failed Test  Status Wstat Total Fail  Failed  List of failed
33 -----------------------------------------------------------------------
34 lib/anydbm.t                 12    1   8.33%  12
35 pragma/warnings             333    1   0.30%  215
36
37 8 tests and 24 subtests skipped.
38 Failed 2/229 test scripts, 99.13% okay. 2/10850 subtests failed,
39     99.98% okay.
40
41There are quite a few systems out there that do worse!
42
43However, since I am running a very recent Hurd snapshot, in which a lot of
44bugs that were exposed by the Perl test suite have been fixed, you may
45encounter more failures.  Likely candidates are: "op/stat", "lib/io_pipe",
46"lib/io_sock", "lib/io_udp" and "lib/time".
47
48In any way, if you're seeing failures beyond those mentioned in this
49document, please consider upgrading to the latest Hurd before reporting
50the failure as a bug.
51
52=head1 AUTHOR
53
54Mark Kettenis <kettenis@gnu.org>
55
56Last Updated: Fri, 29 Oct 1999 22:50:30 +0200
57
58

README.irix

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see.  It is written in the POD format (see pod/perlpod.pod) which is
5specifically designed to be readable as is.
6
7=head1 NAME
8
9perlirix - Perl version 5 on Irix systems
10
11=head1 DESCRIPTION
12
13This document describes various features of Irix that will affect how Perl
14version 5 (hereafter just Perl) is compiled and/or runs.
15
16=head2 Building 32-bit Perl in Irix
17
18Use
19
20	sh Configure -Dcc='cc -n32'
21
22to compile Perl 32-bit.  Don't bother with -n32 unless you have 7.1
23or later compilers (use cc -version to check).
24
25(Building 'cc -n32' is the default.)
26
27=head2 Building 64-bit Perl in Irix
28
29Use
30
31	sh Configure -Dcc='cc -64' -Duse64bitint
32
33This requires require a 64-bit MIPS CPU (R8000, R10000, ...)
34
35You can also use
36
37	sh Configure -Dcc='cc -64' -Duse64bitall
38
39but that makes no difference compared with the -Duse64bitint because
40of the C<cc -64>.
41
42You can also do
43
44	sh Configure -Dcc='cc -n32' -Duse64bitint
45
46to use long longs for the 64-bit integer type, in case you don't
47have a 64-bit CPU.
48
49If you are using gcc, just
50
51	sh Configure -Dcc=gcc -Duse64bitint
52
53should be enough, the Configure should automatically probe for the
54correct 64-bit settings.
55
56=head2 About Compiler Versions of Irix
57
58Some Irix cc versions, e.g. 7.3.1.1m (try cc -version) have been known
59to have issues (coredumps) when compiling perl.c.  If you've used
60-OPT:fast_io=ON and this happens, try removing it.  If that fails, or
61you didn't use that, then try adjusting other optimization options
62(-LNO, -INLINE, -O3 to -O2, et cetera).  The compiler bug has been
63reported to SGI.  (Allen Smith <easmith@beatrice.rutgers.edu>)
64
65=head2 Linker Problems in Irix
66
67If you get complaints about so_locations then search in the file
68hints/irix_6.sh for "lddflags" and do the suggested adjustments.
69(David Billinghurst <David.Billinghurst@riotinto.com.au>)
70
71=head2 Malloc in Irix
72
73Do not try to use Perl's malloc, this will lead into very mysterious
74errors (especially with -Duse64bitall).
75
76=head2 Building with threads in Irix
77
78Run Configure with -Duseithreads which will configure Perl with
79the Perl 5.8.0 "interpreter threads", see L<threads>.
80
81For Irix 6.2 with perl threads, you have to have the following
82patches installed:
83
84        1404 Irix 6.2 Posix 1003.1b man pages
85        1645 Irix 6.2 & 6.3 POSIX header file updates
86        2000 Irix 6.2 Posix 1003.1b support modules
87        2254 Pthread library fixes
88        2401 6.2 all platform kernel rollup
89
90B<IMPORTANT>: Without patch 2401, a kernel bug in Irix 6.2 will cause
91your machine to panic and crash when running threaded perl.  Irix 6.3
92and later are okay.
93
94    Thanks to Hannu Napari <Hannu.Napari@hut.fi> for the IRIX
95    pthreads patches information.
96
97=head2 Irix 5.3
98
99While running Configure and when building, you are likely to get
100quite a few of these warnings:
101
102  ld:
103  The shared object /usr/lib/libm.so did not resolve any symbols.
104        You may want to remove it from your link line.
105
106Ignore them: in IRIX 5.3 there is no way to quieten ld about this.
107
108During compilation you will see this warning from toke.c:
109
110  uopt: Warning: Perl_yylex: this procedure not optimized because it
111        exceeds size threshold; to optimize this procedure, use -Olimit
112        option with value >= 4252.
113
114Ignore the warning.
115
116In IRIX 5.3 and with Perl 5.8.1 (Perl 5.8.0 didn't compile in IRIX 5.3)
117the following failures are known.
118
119 Failed Test                  Stat Wstat Total Fail  Failed|Failing List
120 -----------------------------------------------------------------------
121 ../ext/List/Util/t/shuffle.t    0   139    ??   ??       %  ??
122 ../lib/Math/Trig.t            255 65280    29   12  41.38%  24-29
123 ../lib/sort.t                   0   138   119   72  60.50%  48-119
124 56 tests and 474 subtests skipped.
125 Failed 3/811 test scripts, 99.63% okay. 78/75813 subtests failed,
126    99.90% okay.
127
128They are suspected to be compiler errors (at least the shuffle.t
129failure is known from some IRIX 6 setups) and math library errors
130(the Trig.t failure), but since IRIX 5 is long since end-of-lifed,
131further fixes for the IRIX are unlikely.  If you can get gcc for 5.3,
132you could try that, too, since gcc in IRIX 6 is a known workaround for
133at least the shuffle.t and sort.t failures.
134
135=head1 AUTHOR
136
137Jarkko Hietaniemi <jhi@iki.fi>
138
139Please report any errors, updates, or suggestions to
140L<https://github.com/Perl/perl5/issues>.
141
142

README.jp

1# vim: syntax=pod
2
3=encoding utf8
4
5=head1 NAME
6
7perljp - 日本語 Perl ガイド
8
9=head1 説明
10
11Perl の世界へようこそ!
12
13Perl 5.8.0 より、Unicodeサポートが大幅に強化され、その結果ラテン文字以外の文字コードのサポートが CJK (中国語、日本語、ハングル)を含めて加わりました。Unicodeは世界中の文字を一つの文字コードで扱うことを目指した標準規格であり、東から西、はたまたその間の文字(ギリシャ文字、キリール文字、アラビア文字、ヘブライ文字、ディーヴァナガーリ文字、などなど)や、これまではOSベンダーが独自に定めていた文字(PCおよびMacintosh)がすでに含まれています。
14
15Perl 自身は Unicode で動作します。Perl スクリプト内の文字列リテラルや正規表現は Unicode を前提としています。そして入出力のためには、これまで使われてきたさまざまな文字コードに対応するモジュール、「 Encode 」が標準装備されており、Unicode とこれらの文字コードの相互変換も簡単に行えるようになっています。
16
17現時点で Encode がサポートする文字コードは以下のとおりです。
18
19  7bit-jis      AdobeStandardEncoding AdobeSymbol       AdobeZdingbat
20  ascii             big5              big5-hkscs        cp1006
21  cp1026            cp1047            cp1250            cp1251
22  cp1252            cp1253            cp1254            cp1255
23  cp1256            cp1257            cp1258            cp37
24  cp424             cp437             cp500             cp737
25  cp775             cp850             cp852             cp855
26  cp856             cp857             cp860             cp861
27  cp862             cp863             cp864             cp865
28  cp866             cp869             cp874             cp875
29  cp932             cp936             cp949             cp950
30  dingbats          euc-cn            euc-jp            euc-kr
31  gb12345-raw       gb2312-raw        gsm0338           hp-roman8
32  hz                iso-2022-jp       iso-2022-jp-1     iso-8859-1
33  iso-8859-10       iso-8859-11       iso-8859-13       iso-8859-14
34  iso-8859-15       iso-8859-16       iso-8859-2        iso-8859-3
35  iso-8859-4        iso-8859-5        iso-8859-6        iso-8859-7
36  iso-8859-8        iso-8859-9        iso-ir-165        jis0201-raw
37  jis0208-raw       jis0212-raw       johab             koi8-f
38  koi8-r            koi8-u            ksc5601-raw       MacArabic
39  MacCentralEurRoman  MacChineseSimp    MacChineseTrad    MacCroatian
40  MacCyrillic       MacDingbats       MacFarsi          MacGreek
41  MacHebrew         MacIcelandic      MacJapanese       MacKorean
42  MacRoman          MacRomanian       MacRumanian       MacSami
43  MacSymbol         MacThai           MacTurkish        MacUkrainian
44  nextstep          posix-bc          shiftjis          symbol
45  UCS-2BE           UCS-2LE           UTF-16            UTF-16BE
46  UTF-16LE          UTF-32            UTF-32BE          UTF-32LE
47  utf8              viscii
48
49(全114種類)
50
51例えば、文字コードFOOのファイルをUTF-8に変換するには、以下のようにします。
52
53    perl -Mencoding=FOO,STDOUT,utf8 -pe1 < file.FOO > file.utf8
54
55また、Perlには、全部がPerlで書かれた文字コード変換ユーティリティ、piconvも付属しているので、以下のようにすることもできます。
56
57   piconv -f FOO -t utf8 < file.FOO > file.utf8
58   piconv -f utf8 -t FOO < file.utf8 > file.FOO
59
60=head2 (jcode.pl|Jcode.pm|JPerl) からの移行
61
625.8以前の、スクリプトがEUC-JPであればリテラルだけは扱うことができました。また、入出力を扱うモジュールとしてはJcode.pmが( L<http://openlab.ring.gr.jp/Jcode/> )、perl4用のユーティリティとしてはjcode.plがそれぞれ存在し、日本語の扱えるCGIでよく利用されていることを御存じの方も少なくないかと思われます。ただし、日本語による正規表現をうまく扱うことは不可能でした。
63
645.005以前のPerlには、日本語に特化したローカライズ版、Jperlが存在しました( L<http://homepage2.nifty.com/kipp/perl/jperl/index.html> ※1)。また、Mac OS 9.x/Classic用のPerl、MacPerlの日本語版もMacJPerlとして存在してました。( L<https://habilis.net/macjperl/> ).これらでは文字コードとしてEUC-JPに加えShift_JISもそのまま扱うことができ、また日本語による正規表現を扱うことも可能でした。
65
66Perl5.8では、これらの機能がすべてPerl本体だけで実現できる上に、日本語のみならず上記114の文字コードをすべて、しかも同時に扱うことができます。さらに、CPANなどから新しい文字コード用のモジュールを入手することも簡単にできるようになっています。
67
68※1: ホスティングサービスの終了により現在は閲覧できません。 Vector( L<https://www.vector.co.jp/soft/win95/util/se098198.html> )からWindow用のバイナリを、CPAN( L<https://www.cpan.org/src/unsupported/4.036/jperl/> )からperl4用のパッチを入手することができます。
69
70=over 4
71
72=item *
73
74入出力
75
76以下の例はいずれもShift_JISの入力をEUC-JPに変換して出力します。
77
78  # jcode.pl
79  require "jcode.pl";
80  while(<>){
81    jcode::convert(*_, 'euc', 'sjis');
82    print;
83  }
84  # Jcode.pm
85  use Jcode;
86  while(<>){
87  	print Jcode->new($_, 'sjis')->euc;
88  }
89  # Perl 5.8
90  use Encode;
91  while(<>){
92    from_to($_, 'shiftjis', 'euc-jp');
93    print;
94  }
95  # Perl 5.8 - encoding を利用して
96  use encoding 'euc-jp', STDIN => 'shiftjis';
97  while(<>){
98  	print;
99  }
100
101=item *
102
103Jperl 互換スクリプト
104
105いわゆる"shebang"を変更するだけで、Jperl用のscriptのほとんどは変更なしに利用可能だと思われます。
106
107   #!/path/to/jperl
108109   #!/path/to/perl -Mencoding=euc-jp
110
111詳しくは perldoc encoding を参照してください。
112
113=back
114
115=head2 さらに詳しく
116
117Perlには膨大な資料が付属しており、Perlの新機能やUnicodeサポート、そしてEncodeモジュールの使用法などが細かく網羅されています(残念ながら、ほとんど英語ではありますが)。以下のコマンドでそれらの一部を閲覧することが可能です。
118
119  perldoc perlunicode # PerlのUnicodeサポート全般
120  perldoc Encode      # Encodeモジュールに関して
121  perldoc Encode::JP  # うち日本語文字コードに関して
122
123=head2 Perl全般に関する URL
124
125=over 4
126
127=item L<https://www.perl.org/>
128
129Perl ホームページ
130
131=item L<https://www.perl.com/>
132
133Perl 財団が営業する文章作品集
134
135=item L<https://www.cpan.org/>
136
137CPAN (Comprehensive Perl Archive Network)
138
139=item L<https://metacpan.org/>
140
141MetaCPAN CPANの検索エンジン
142
143=item L<https://lists.perl.org/>
144
145Perl メーリングリスト集
146
147=item L<https://perldoc.jp/>
148
149perldoc.jp Perl の公式ドキュメント、モジュールドキュメントの日本語訳
150
151=back
152
153=head2 Perlの修得に役立つ URL
154
155=over 4
156
157=item L<http://www.oreilly.com.cn/>
158
159O'Reilly 社のPerl関連書籍(簡体字中国語)
160
161=item L<https://www.oreilly.co.jp/catalog/>
162
163オライリー社のPerl関連書籍(日本語)
164
165=back
166
167=head2 Perl に関する団体
168
169=over 4
170
171=item L<https://www.pm.org/groups/asia.html>
172
173アジア地域の Perl Mongers (Perlのユーザーグループ) 一覧
174
175=item L<https://japan.perlassociation.org>
176
177一般社団法人Japan Perl Association (JPA) Perl技術及び文化の啓蒙・促進のための組織
178
179=back
180
181=head2 Unicode関連のURL
182
183=over 4
184
185=item L<https://www.unicode.org/>
186
187Unicode コンソーシアム (Unicode規格の選定団体)
188
189=item L<https://www.cl.cam.ac.uk/%7Emgk25/unicode.html>
190
191UTF-8 and Unicode FAQ for Unix/Linux
192
193=item L<https://wiki.kldp.org/Translations/html/UTF8-Unicode-KLDP/UTF8-Unicode-KLDP.html>
194
195UTF-8 and Unicode FAQ for Unix/Linux (ハングル訳)
196
197=back
198
199=head1 AUTHORS
200
201=over
202
203=item * Jarkko Hietaniemi E<lt>jhi@iki.fiE<gt>
204
205=item * Dan Kogai (小飼 弾) E<lt>dankogai@dan.co.jpE<gt>
206
207=item * Shogo Ichinose (一野瀬 翔吾) E<lt>shogo82148@gmail.comE<gt>
208
209=back
210
211=cut
212

README.ko

1# vim: syntax=pod
2
3이 파일을 내용 그대로 읽고 있다면 우스꽝스러운 문자는 무시해주세요.
4이 문서는 POD로 읽을 수 있도록 POD 형식(F<pod/perlpod.pod> 문서를
5확인하세요)으로 작성되어 있습니다.
6
7=encoding utf8
8
9=head1 NAME
10
11perlko - 한국어 Perl 안내서
12
13=head1 DESCRIPTION
14
15Perl의 세계에 오신 것을 환영합니다!
16
17Perl은 가끔 B<'Practical Extraction and Report Language'>라고 하기도 합니다만
18다른 널리 알려진 것들 중에서 B<'Pathologically Eclectic Rubbish Lister'>라고
19하기도 합니다. 사실 이것은 끼워 맞춘 것이며 Perl이 이것들의 첫 글자를
20가져와서 이름을 붙인 것은 아닙니다. Perl의 창시자 Larry가 첫 번째 이름을
21먼저 생각했고 널리 알려진 것을 나중에 지었기 때문입니다. 그렇기 때문에
22B<'Perl'>은 모두 대문자가 아닙니다. 널리 알려진 어떤 것을 가지고 논쟁하는
23것은 의미가 없습니다. Larry는 두 개 다 지지합니다.
24
25가끔 p가 소문자로 작성된 B<'perl'>을 볼 것입니다. P가 대문자로 되어 있는
26B<'Perl'>은 언어를 참조할 때 쓰이며 B<'perl'>처럼 p가 소문자인 경우는 여러분의
27프로그램을 컴파일하고 돌릴 때 사용되는 해석기를 지칭할 때 사용됩니다.
28
29
30=head1 Perl에 관하여
31
32Perl은 본래 문자열 생성을 위해 만들졌지만 지금은 시스템 관리와 웹 개발,
33네트워크 프로그래밍, GUI 개발 등을 포함한 여러 분야에서 널리 사용되는
34범용 프로그래밍 언어입니다.
35
36이 언어는 아름다움(아주 작고, 우아하고, 아주 적고)보다
37실용적(사용하기 쉽고, 효율적이며, 가능한 최대한)인 것을 지향하고 있습니다.
38사용하기 쉽고, 절차적 프로그래밍과 객체 지향 프로그래밍을 모두 지원하고,
39강력한 문자열 처리 기능을 내장하고, 세상에서 가장 인상적인 제 3자의 모듈
40모음처를 가지고 있다는 것은 Perl의 가장 중요한 특징입니다.
41
42Perl의 언어적 특징은 F<pod/perlintro.pod> 문서에서 소개합니다.
43
44이번 릴리스에서 가장 중요한 변화는 F<pod/perldelta.pod>에서 논의합니다.
45
46또한 다양한 출판사가 출판한 많은 Perl 책은 다양한 주제를 다루고 있습니다.
47자세한 정보는 F<pod/perlbook.pod> 문서를 확인하세요.
48
49
50=head1 설치
51
52여러분이 비교적 현대의 운영체제를 사용하고 있고 현재 버전의 Perl을
53지역적으로 설치하고 싶다면 다음 명령을 실행하세요.
54
55    ./Configure -des -Dprefix=$HOME/localperl
56    make test
57    make install
58
59앞의 명령은 여러분의 플랫폼에 맞게 환경을 설정하고 컴파일을 수행한 후,
60회기 테스트를 수행한뒤, 홈 디렉터리 하부의 F<localperl> 디렉터리에 perl을
61설치합니다.
62
63여러분이 어떠한 문제든 겪게 되거나 사용자 정의 버전 Perl을 설치할 필요가 있다면
64현재 배포판에 들어있는 F<INSTALL> 파일 안의 자세한 설명을 읽어야 합니다.
65추가적으로 일반적이지 않은 다양한 플랫폼에서 Perl을 빌드하고 사용하는
66방법에 대한 도움말과 귀띔이 적혀있는 많은 수의 F<README> 파일이 있습니다.
67
68일단 Perl을 설치하고 나면 C<perldoc> 도구를 이용해 풍부한 문서를 사용할
69수 있습니다. 시작하기 위해서 다음 명령을 실행하세요.
70
71    perldoc perl
72
73
74=head1 실행에 어려움을 겪는다면
75
76Perl은 뜨개질에서 부터 로켓 과학까지 모든 분야에서 사용할 수 있는 크고
77복잡한 시스템입니다. 여러분이 어려움에 부딪혔을때 그 문제는 이미 다른
78사람이 해결했을 가능성이 높습니다. 문서를 모두 확인했는데도 버그가
79확실하다면 C<perlbug> 도구를 이용해서 저희에게 버그를 보고해주세요.
80C<perlbug>에 대한 더 자세한 정보는 C<perldoc perlbug> 또는 C<perlbug>를
81명령줄에서 실행해서 확인할 수 있습니다.
82
83Perl을 사용 가능하게 만들었다 하더라도 Perl은 계속해서 진화하기 때문에
84여러분이 맞닥뜨린 버그를 수정했거나 여러분이 유용하다고 생각할법한
85새로운 기능이 추가된 좀 더 최신 버전이 있을 수 있습니다.
86
87여러분은 항상 최신 버전의 perl을 CPAN (Comprehensive Perl Archive Network)
88사이트 L<http://www.cpan.org/src/> 에서 찾을 수 있습니다.
89
90perl 소스에 간단한 패치를 등록하고 싶다면 F<pod/perlhack.pod> 문서의
91B<"SUPER QUICK PATCH GUIDE">를 살펴보세요.
92
93그냥 개인적으로 참고하세요.
94제가 이것처럼 멋진 물건을 만든다는 것을 여러분이 알기를 바랍니다.
95그것은 제 이야기의 B<"저자(Author)">를 기쁘게하기 때문입니다.
96이것이 여러분을 귀찮게 한다면 여러분의 B<"저작(Authorship)">에
97대한 생각을 정정해야 할 수도 있습니다. 하지만 어쨌거나 여러분은
98Perl을 사용하는데는 문제가 없답니다. :-)
99
100- B<"저자">로부터.
101
102
103=head1 인코딩
104
105Perl은 5.8.0판부터 유니코드/ISO 10646에 대해 광범위하게 지원합니다.
106유니코드 지원의 일환으로 한중일을 비롯한 세계 각국에서
107유니코드 이전에 쓰고 있었고 지금도 널리 쓰이고 있는 수많은 인코딩을
108지원합니다. 유니코드는 전 세계에서 쓰이는 모든 언어를 위한
109표기 체계(유럽의 라틴 알파벳, 키릴 알파벳, 그리스 알파벳, 인도와 동남 아시아의
110브라미 계열 스크립트, 아랍 문자, 히브리 문자, 한중일의 한자, 한국어의 한글,
111일본어의 가나, 북미 인디안의 표기 체계 등)를 수용하는 것을 목표로 하고
112있기 때문에 기존에 쓰이던  각 언어 및 국가 그리고 운영 체계에 고유한
113문자 집합과 인코딩에 쓸 수 있는 모든 글자는 물론이고  기존 문자 집합에서
114지원하고 있지 않던 아주 많은 글자를  포함하고 있습니다.
115
116Perl은 내부적으로 유니코드를 문자 표현을 위해 사용합니다.
117보다 구체적으로 말하면 Perl 스크립트 안에서  UTF-8 문자열을 쓸 수 있고,
118각종 함수와 연산자(예를 들어, 정규식, index, substr)가 바이트 단위
119대신 유니코드 글자 단위로 동작합니다.
120더 자세한 것은 F<pod/perlunicode.pod> 문서를 참고하세요.
121유니코드가 널리 보급되기 전에 널리 쓰이고 있었고, 여전히 널리 쓰이고 있는
122각국/각 언어별 인코딩으로 입출력을 하고 이들 인코딩으로 된 데이터와 문서를
123다루는 것을 돕기 위해 L<Encode> 모듈이 쓰이고 있습니다.
124무엇보다 L<Encode> 모듈을 사용하면 수많은 인코딩 사이의 변환을 쉽게 할 수 있습니다.
125
126
127=head2 Encode 모듈
128
129=head3 지원 인코딩
130
131L<Encode> 모듈은 다음과 같은 한국어 인코딩을 지원합니다.
132
133=over 4
134
135=item * C<euc-kr>
136
137US-ASCII와 KS X 1001을 같이 쓰는 멀티바이트 인코딩으로 흔히
138완성형이라고 불림. KS X 2901과 RFC 1557 참고.
139
140=item * C<cp949>
141
142MS-Windows 9x/ME에서 쓰이는 확장 완성형. euc-kr에 8,822자의
143한글 음절을 더한 것임. alias는 uhc, windows-949, x-windows-949,
144ks_c_5601-1987. 맨 마지막 이름은 적절하지 않은 이름이지만, Microsoft
145제품에서 CP949의 의미로 쓰이고 있음.
146
147=item * C<johab>
148
149KS X 1001:1998 부록 3에서 규정한 조합형. 문자 레퍼토리는 cp949와 마찬가지로
150US-ASCII와  KS X 1001에 8,822자의 한글 음절을 더한 것으로 인코딩 방식은 전혀 다름.
151
152=item * C<iso-2022-kr>
153
154RFC 1557에서 규정한 한국어 인터넷 메일 교환용 인코딩으로 US-ASCII와
155KS X 1001을 레퍼토리로 하는 점에서 euc-kr과 같지만 인코딩 방식이 다름.
1561997-8년 경까지 쓰였으나 더 이상 메일 교환에 쓰이지 않음.
157
158=item * C<ksc5601-raw>
159
160KS X 1001(KS C 5601)을 GL(즉, MSB를 0으로 한 경우)에 놓았을 때의 인코딩.
161US-ASCII와 결합하지 않고 단독으로 쓰이는 일은 X11 등에서 글꼴
162인코딩(ksc5601.1987-0. '0'은 GL을 의미함)으로 쓰이는 것을 제외하고는
163거의 없음. KS C 5601은 1997년 KS X 1001로 이름을 바꾸었음. 1998년에는 두
164글자(유로화 부호와 등록 상표 부호)가 더해졌음.
165
166=back
167
168=head3 변환 예제
169
170예를 들어, euc-kr 인코딩으로 된 파일을 UTF-8로 변환하려면
171명령줄에서 다음처럼 실행합니다.
172
173    perl -Mencoding=euc-kr,STDOUT,utf8 -pe1 < file.euc-kr > file.utf8
174
175반대로 변환할 경우 다음처럼 실행합니다.
176
177    perl -Mencoding=utf8,STDOUT,euc-kr -pe1 < file.utf8 > file.euc-kr
178
179이런 변환을 좀더 편리하게 할 수 있도록 도와주는 F<piconv>가 Perl에
180기본으로 들어있습니다. 이 유틸리티는 L<Encode> 모듈을 이용한 순수 Perl
181유틸리티로 이름에서 알 수 있듯이 Unix의 C<iconv>를 모델로 한 것입니다.
182사용법은 다음과 같습니다.
183
184   piconv -f euc-kr -t utf8 < file.euc-kr > file.utf8
185   piconv -f utf8 -t euc-kr < file.utf8 > file.euc-kr
186
187=head3 모범 사례
188
189Perl은 기본적으로 내부에서 UTF-8을 사용하며 Encode 모듈을 통해
190다양한 인코딩을 지원하지만 항상 다음 규칙을 지킴으로써 인코딩과
191관련한 다양하게 발생할 수 있는 문제의 가능성을 줄이는 것을 추천합니다.
192
193=over 4
194
195=item * 소스 코드는 항상 UTF-8 인코딩으로 저장
196
197=item * 소스 코드 상단에 C<use utf8;> 프라그마 사용
198
199=item * 소스 코드, 터미널, 운영체제, 데이터 인코딩을 분리해서 이해
200
201=item * 입출력 파일 핸들에 명시적인 인코딩을 사용
202
203=item * 중복(double) 인코딩을 주의
204
205=back
206
207
208=head3 유니코드 및 한국어 인코딩 관련 자료
209
210=over 4
211
212=item * L<perluniintro>
213
214=item * L<perlunicode>
215
216=item * L<Encode>
217
218=item * L<Encode::KR>
219
220=item * L<encoding>
221
222=item * L<https://www.unicode.org/>
223
224유니코드 컨소시엄
225
226=item * L<http://std.dkuug.dk/JTC1/SC2/WG2>
227
228기본적으로 Unicode와 같은 ISO 표준인  ISO/IEC 10646 UCS(Universal
229Character Set)을 만드는 ISO/IEC JTC1/SC2/WG2의 웹 페이지
230
231=item * L<https://www.cl.cam.ac.uk/~mgk25/unicode.html>
232
233유닉스/리눅스 사용자를 위한 UTF-8 및 유니코드 관련 FAQ
234
235=item * L<http://wiki.kldp.org/Translations/html/UTF8-Unicode-KLDP/UTF8-Unicode-KLDP.html>
236
237유닉스/리눅스 사용자를 위한 UTF-8 및 유니코드 관련 FAQ의 한국어 번역
238
239=back
240
241
242=head1 Perl 관련 자료
243
244다음은 공식적인 Perl 관련 자료중 일부입니다.
245
246=over 4
247
248=item * L<https://www.perl.org/>
249
250Perl 공식 홈페이지
251
252=item * L<https://www.perl.com/>
253
254O'Reilly의 Perl 웹 페이지
255
256=item * L<https://www.cpan.org/>
257
258CPAN - Comprehensive Perl Archive Network, 통합적 Perl 파일 보관 네트워크
259
260=item * L<https://metacpan.org>
261
262메타 CPAN
263
264=item * L<https://lists.perl.org/>
265
266Perl 메일링 리스트
267
268=item * L<http://blogs.perl.org/>
269
270Perl 메타 블로그
271
272=item * L<https://www.perlmonks.org/>
273
274Perl 수도승들을 위한 수도원
275
276=item * L<https://www.pm.org/groups/asia.html>
277
278아시아 지역 Perl 몽거스 모임
279
280=item * L<http://www.perladvent.org/>
281
282Perl 크리스마스 달력
283
284=back
285
286
287다음은 Perl을 더 깊게 공부하는데 도움을 줄 수 있는 한국어 관련 사이트입니다.
288
289=over 4
290
291=item * L<https://perl.kr/>
292
293한국 Perl 커뮤니티 공식 포털
294
295=item * L<https://doc.perl.kr/>
296
297Perl 문서 한글화 프로젝트
298
299=item * L<https://cafe.naver.com/perlstudy.cafe>
300
301네이버 Perl 카페
302
303=item * L<http://www.perl.or.kr/>
304
305한국 Perl 사용자 모임
306
307=item * L<https://advent.perl.kr>
308
309Seoul.pm Perl 크리스마스 달력 (2010 ~ 2012)
310
311=item * L<http://gypark.pe.kr/wiki/Perl>
312
313GYPARK(Geunyoung Park)의 Perl 관련 한글 문서 저장소
314
315=back
316
317
318=head1 라이센스
319
320F<README> 파일의 B<'LICENSING'> 항목을 참고하세요.
321
322
323=head1 AUTHORS
324
325=over
326
327=item * Jarkko Hietaniemi E<lt>jhi@iki.fiE<gt>
328
329=item * 신정식 E<lt>jshin@mailaps.orgE<gt>
330
331=item * 김도형 E<lt>keedi@cpan.orgE<gt>
332
333=back
334
335
336=cut
337

README.linux

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see.  It is written in the POD format (see pod/perlpod.pod) which is
5specifically designed to be readable as is.
6
7=head1 NAME
8
9perllinux - Perl version 5 on Linux systems
10
11=head1 DESCRIPTION
12
13This document describes various features of Linux that will affect how Perl
14version 5 (hereafter just Perl) is compiled and/or runs.
15
16=head2 Deploying Perl on Linux
17
18Normally one can install F</usr/bin/perl> on Linux using your distribution's
19package manager (e.g: C<sudo apt-get install perl>, or
20C<sudo dnf install perl>). Note that sometimes one needs to install some
21extra system packages in order to be able to use CPAN frontends, and that
22messing with the system's perl is not always recommended. One can use
23L<perlbrew|https://perlbrew.pl/> to avoid such issues.
24
25Otherwise, perl should build fine on Linux using the mainstream compilers
26GCC and clang, while following the usual instructions.
27
28=head2 Experimental Support for Sun Studio Compilers for Linux OS
29
30Sun Microsystems has released a port of their Sun Studio compilers for
31Linux.  As of May 2019, the last stable release took place on 2017, and one can
32buy support contracts for them.
33
34There are some special instructions for building Perl with Sun Studio on
35Linux.  Following the normal C<Configure>, you have to run make as follows:
36
37    LDLOADLIBS=-lc make
38
39C<LDLOADLIBS> is an environment variable used by the linker to link
40C</ext> modules to glibc.  Currently, that environment variable is not getting
41populated by a combination of C<Config> entries and C<ExtUtil::MakeMaker>.
42While there may be a bug somewhere in Perl's configuration or
43C<ExtUtil::MakeMaker> causing the problem, the most likely cause is an
44incomplete understanding of Sun Studio by this author.  Further investigation
45is needed to get this working better.
46
47=head1 AUTHOR
48
49Steve Peters <steve@fisharerojo.org>
50
51Please report any errors, updates, or suggestions to
52L<https://github.com/Perl/perl5/issues>.
53
54

README.macosx

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlmacosx - Perl under Mac OS X
10
11=head1 SYNOPSIS
12
13This document briefly describes Perl under Mac OS X.
14
15  curl -O https://www.cpan.org/src/perl-5.38.2.tar.gz
16  tar -xzf perl-5.38.2.tar.gz
17  cd perl-5.38.2
18  ./Configure -des -Dprefix=/usr/local/
19  make
20  make test
21  sudo make install
22
23=head1 DESCRIPTION
24
25The latest Perl release (5.38.2 as of this writing) builds without changes
26under all versions of Mac OS X from 10.3 "Panther" onwards.
27
28In order to build your own version of Perl you will need 'make',
29which is part of Apple's developer tools - also known as Xcode. From
30Mac OS X 10.7 "Lion" onwards, it can be downloaded separately as the
31'Command Line Tools' bundle directly from L<https://developer.apple.com/downloads/>
32(you will need a free account to log in), or as a part of the Xcode suite,
33freely available at the App Store. Xcode is a pretty big app, so
34unless you already have it or really want it, you are advised to get the
35'Command Line Tools' bundle separately from the link above. If you want
36to do it from within Xcode, go to Xcode -> Preferences -> Downloads and
37select the 'Command Line Tools' option.
38
39Between Mac OS X 10.3 "Panther" and 10.6 "Snow Leopard", the 'Command
40Line Tools' bundle was called 'unix tools', and was usually supplied
41with Mac OS install DVDs.
42
43Earlier Mac OS X releases (10.2 "Jaguar" and older) did not include a
44completely thread-safe libc, so threading is not fully supported. Also,
45earlier releases included a buggy libdb, so some of the DB_File tests
46are known to fail on those releases.
47
48
49=head2 Installation Prefix
50
51The default installation location for this release uses the traditional
52UNIX directory layout under /usr/local. This is the recommended location
53for most users, and will leave the Apple-supplied Perl and its modules
54undisturbed.
55
56Using an installation prefix of '/usr' will result in a directory layout
57that mirrors that of Apple's default Perl, with core modules stored in
58'/System/Library/Perl/${version}', CPAN modules stored in
59'/Library/Perl/${version}', and the addition of
60'/Network/Library/Perl/${version}' to @INC for modules that are stored
61on a file server and used by many Macs.
62
63
64=head2 SDK support
65
66First, export the path to the SDK into the build environment:
67
68 export SDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
69
70Please make sure the SDK version (i.e. the numbers right before '.sdk')
71matches your system's (in this case, Mac OS X 10.8 "Mountain Lion"), as it is
72possible to have more than one SDK installed. Also make sure the path exists
73in your system, and if it doesn't please make sure the SDK is properly
74installed, as it should come with the 'Command Line Tools' bundle mentioned
75above. Finally, if you have an older Mac OS X (10.6 "Snow Leopard" and below)
76running Xcode 4.2 or lower, the SDK path might be something like
77C<'/Developer/SDKs/MacOSX10.3.9.sdk'>.
78
79You can use the SDK by exporting some additions to Perl's 'ccflags' and '..flags'
80config variables:
81
82    ./Configure -Accflags="-nostdinc -B$SDK/usr/include/gcc \
83                           -B$SDK/usr/lib/gcc -isystem$SDK/usr/include \
84                           -F$SDK/System/Library/Frameworks" \
85                -Aldflags="-Wl,-syslibroot,$SDK" \
86                -de
87
88=head2 Universal Binary support
89
90Note: From Mac OS X 10.6 "Snow Leopard" onwards, Apple only supports
91Intel-based hardware. This means you can safely skip this section unless
92you have an older Apple computer running on ppc or wish to create a perl
93binary with backwards compatibility.
94
95You can compile perl as a universal binary (built for both ppc and intel).
96In Mac OS X 10.4 "Tiger", you must export the 'u' variant of the SDK:
97
98    export SDK=/Developer/SDKs/MacOSX10.4u.sdk
99
100Mac OS X 10.5 "Leopard" and above do not require the 'u' variant.
101
102In addition to the compiler flags used to select the SDK, also add the flags
103for creating a universal binary:
104
105 ./Configure -Accflags="-arch i686 -arch ppc -nostdinc               \
106                         -B$SDK/usr/include/gcc                      \
107                        -B$SDK/usr/lib/gcc -isystem$SDK/usr/include  \
108                        -F$SDK/System/Library/Frameworks"            \
109             -Aldflags="-arch i686 -arch ppc -Wl,-syslibroot,$SDK"   \
110             -de
111
112Keep in mind that these compiler and linker settings will also be used when
113building CPAN modules. For XS modules to be compiled as a universal binary, any
114libraries it links to must also be universal binaries. The system libraries that
115Apple includes with the 10.4u SDK are all universal, but user-installed libraries
116may need to be re-installed as universal binaries.
117
118=head2 64-bit PPC support
119
120Follow the instructions in F<INSTALL> to build perl with support for 64-bit
121integers (C<use64bitint>) or both 64-bit integers and 64-bit addressing
122(C<use64bitall>). In the latter case, the resulting binary will run only
123on G5-based hosts.
124
125Support for 64-bit addressing is experimental: some aspects of Perl may be
126omitted or buggy. Note the messages output by F<Configure> for further
127information. Please use L<https://github.com/Perl/perl5/issues> to submit a
128problem report in the event that you encounter difficulties.
129
130When building 64-bit modules, it is your responsibility to ensure that linked
131external libraries and frameworks provide 64-bit support: if they do not,
132module building may appear to succeed, but attempts to use the module will
133result in run-time dynamic linking errors, and subsequent test failures.
134You can use C<file> to discover the architectures supported by a library:
135
136    $ file libgdbm.3.0.0.dylib
137    libgdbm.3.0.0.dylib: Mach-O fat file with 2 architectures
138    libgdbm.3.0.0.dylib (for architecture ppc):      Mach-O dynamically linked shared library ppc
139    libgdbm.3.0.0.dylib (for architecture ppc64):    Mach-O 64-bit dynamically linked shared library ppc64
140
141Note that this issue precludes the building of many Macintosh-specific CPAN
142modules (C<Mac::*>), as the required Apple frameworks do not provide PPC64
143support. Similarly, downloads from Fink or Darwinports are unlikely to provide
14464-bit support; the libraries must be rebuilt from source with the appropriate
145compiler and linker flags. For further information, see Apple's
146I<64-Bit Transition Guide> at
147L<https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/64bitPorting/transition/transition.html>.
148
149=head2 libperl and Prebinding
150
151Mac OS X ships with a dynamically-loaded libperl, but the default for
152this release is to compile a static libperl. The reason for this is
153pre-binding. Dynamic libraries can be pre-bound to a specific address in
154memory in order to decrease load time. To do this, one needs to be aware
155of the location and size of all previously-loaded libraries. Apple
156collects this information as part of their overall OS build process, and
157thus has easy access to it when building Perl, but ordinary users would
158need to go to a great deal of effort to obtain the information needed
159for pre-binding.
160
161You can override the default and build a shared libperl if you wish
162(S<Configure ... -Duseshrplib>).
163
164With Mac OS X 10.4 "Tiger" and newer, there is almost no performance
165penalty for non-prebound libraries. Earlier releases will suffer a greater
166load time than either the static library, or Apple's pre-bound dynamic library.
167
168=head2 Updating Apple's Perl
169
170In a word - don't, at least not without a *very* good reason. Your scripts
171can just as easily begin with "#!/usr/local/bin/perl" as with
172"#!/usr/bin/perl". Scripts supplied by Apple and other third parties as
173part of installation packages and such have generally only been tested
174with the /usr/bin/perl that's installed by Apple.
175
176If you find that you do need to update the system Perl, one issue worth
177keeping in mind is the question of static vs. dynamic libraries. If you
178upgrade using the default static libperl, you will find that the dynamic
179libperl supplied by Apple will not be deleted. If both libraries are
180present when an application that links against libperl is built, ld will
181link against the dynamic library by default. So, if you need to replace
182Apple's dynamic libperl with a static libperl, you need to be sure to
183delete the older dynamic library after you've installed the update.
184
185
186=head2 Known problems
187
188If you have installed extra libraries such as GDBM through Fink
189(in other words, you have libraries under F</sw/lib>), or libdlcompat
190to F</usr/local/lib>, you may need to be extra careful when running
191Configure to not to confuse Configure and Perl about which libraries
192to use.  Being confused will show up for example as "dyld" errors about
193symbol problems, for example during "make test". The safest bet is to run
194Configure as
195
196    Configure ... -Uloclibpth -Dlibpth=/usr/lib
197
198to make Configure look only into the system libraries.  If you have some
199extra library directories that you really want to use (such as newer
200Berkeley DB libraries in pre-Panther systems), add those to the libpth:
201
202    Configure ... -Uloclibpth -Dlibpth='/usr/lib /opt/lib'
203
204The default of building Perl statically may cause problems with complex
205applications like Tk: in that case consider building shared Perl
206
207    Configure ... -Duseshrplib
208
209but remember that there's a startup cost to pay in that case (see above
210"libperl and Prebinding").
211
212Starting with Tiger (Mac OS X 10.4), Apple shipped broken locale files for
213the eu_ES locale (Basque-Spain).  In previous releases of Perl, this resulted in
214failures in the F<lib/locale> test. These failures have been suppressed
215in the current release of Perl by making the test ignore the broken locale.
216If you need to use the eu_ES locale, you should contact Apple support.
217
218
219=head2 Cocoa
220
221There are two ways to use Cocoa from Perl. Apple's PerlObjCBridge
222module, included with Mac OS X, can be used by standalone scripts to
223access Foundation (i.e. non-GUI) classes and objects.
224
225An alternative is CamelBones, a framework that allows access to both
226Foundation and AppKit classes and objects, so that full GUI applications
227can be built in Perl. CamelBones can be found on SourceForge, at
228L<https://www.sourceforge.net/projects/camelbones/>.
229
230
231=head1 Starting From Scratch
232
233Unfortunately it is not that difficult somehow manage to break one's
234Mac OS X Perl rather severely.  If all else fails and you want to
235really, B<REALLY>, start from scratch and remove even your Apple Perl
236installation (which has become corrupted somehow), the following
237instructions should do it.  B<Please think twice before following
238these instructions: they are much like conducting brain surgery to
239yourself.  Without anesthesia.>  We will B<not> come to fix your system
240if you do this.
241
242First, get rid of the libperl.dylib:
243
244    # cd /System/Library/Perl/darwin/CORE
245    # rm libperl.dylib
246
247Then delete every .bundle file found anywhere in the folders:
248
249    /System/Library/Perl
250    /Library/Perl
251
252You can find them for example by
253
254    # find /System/Library/Perl /Library/Perl -name '*.bundle' -print
255
256After this you can either copy Perl from your operating system media
257(you will need at least the /System/Library/Perl and /usr/bin/perl),
258or rebuild Perl from the source code with C<Configure -Dprefix=/usr
259-Duseshrplib> NOTE: the C<-Dprefix=/usr> to replace the system Perl
260works much better with Perl 5.8.1 and later, in Perl 5.8.0 the
261settings were not quite right.
262
263"Pacifist" from CharlesSoft (L<https://www.charlessoft.com/>) is a nice
264way to extract the Perl binaries from the OS media, without having to
265reinstall the entire OS.
266
267
268=head1 AUTHOR
269
270This README was written by Sherm Pendley E<lt>sherm@dot-app.orgE<gt>,
271and subsequently updated by Dominic Dunlop E<lt>domo@computer.orgE<gt>
272and Breno G. de Oliveira E<lt>garu@cpan.orgE<gt>. The "Starting From Scratch"
273recipe was contributed by John Montbriand E<lt>montbriand@apple.comE<gt>.
274
275=head1 DATE
276
277Last modified 2013-04-29.
278

README.micro

1microperl is supposed to be a really minimal perl, even more
2minimal than miniperl.  No Configure is needed to build microperl,
3on the other hand this means that interfaces between Perl and your
4operating system are left very -- minimal.
5
6All this is experimental.  If you don't know what to do with microperl
7you probably shouldn't.  Please don't report bugs in microperl; fix the
8bugs.  (Bugs reports about microperl without fixes/patches are equivalent
9to wishlist requests - they won't be discarded, but they likely won't get
10worked on either, unless they chance to coincide with someone's personal itch)
11
12We assume ANSI C89 plus the following:
13- <stddef.h>, <stdlib.h>
14- rename()
15- opendir(), readdir(), closedir() (via dirent.h)
16- memchr(), memcmp(), memcpy(), memset() (via string.h)
17- (a safe) putenv() (via stdlib.h)
18- strtoul() (via stdlib.h)
19(grep for 'define' in uconfig.sh.)
20Also, Perl times() is defined to always return zeroes.
21
22If you are still reading this and you are itching to try out microperl:
23
24	make -f Makefile.micro
25
26The defaults assume a little endian LP32 platform - ie long and pointers are
2732 bits, so sizeof(long) and sizeof(void *) are 4
28If your platform is little endian LP64 - ie long and pointers are 64 bits,
29sizeof(long) and sizeof(void *) are 8, then you first need to run
30
31	make -f Makefile.micro regen_uconfig64
32
33to generate a suitable uconfig.h
34
35If you make changes to uconfig.sh, run
36
37	make -f Makefile.micro regen_uconfig
38
39to regenerate uconfig.h.  (or regen_uconfig64 if you're editing uconfig64.sh)
40
41
42If neither of the above default configs work on your platform, you might want
43to try
44
45	make -f Makefile.micro patch_uconfig
46
47*before* the "make -f Makefile.micro".  This tries to minimally patch
48the uconfig.sh using your *current* Perl so that your microperl has
49the correct basic types and sizes and byteorder.
50

README.openbsd

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see.  It is written in the POD format (see pod/perlpod.pod) which is
5specifically designed to be readable as is.
6
7=head1 NAME
8
9perlopenbsd - Perl version 5 on OpenBSD systems
10
11=head1 DESCRIPTION
12
13This document describes various features of OpenBSD that will affect how Perl
14version 5 (hereafter just Perl) is compiled and/or runs.
15
16=head2 OpenBSD core dumps from getprotobyname_r and getservbyname_r with ithreads
17
18When Perl is configured to use ithreads, it will use re-entrant library calls
19in preference to non-re-entrant versions.  There is an incompatibility in
20OpenBSD's C<getprotobyname_r> and C<getservbyname_r> function in versions 3.7
21and later that will cause a SEGV when called without doing a C<bzero> on
22their return structs prior to calling these functions.  Current Perl's
23should handle this problem correctly.  Older threaded Perls (5.8.6 or earlier)
24will run into this problem.  If you want to run a threaded Perl on OpenBSD
253.7 or higher, you will need to upgrade to at least Perl 5.8.7.
26
27=head1 AUTHOR
28
29Steve Peters <steve@fisharerojo.org>
30
31Please report any errors, updates, or suggestions to
32L<https://github.com/Perl/perl5/issues>.
33
34

README.os2

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see. It is written in the POD format (see perlpod manpage) which is
5specially designed to be readable as is.
6
7=head1 NAME
8
9perlos2 - Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT.
10
11=head1 SYNOPSIS
12
13One can read this document in the following formats:
14
15	man perlos2
16	view perl perlos2
17	explorer perlos2.html
18	info perlos2
19
20to list some (not all may be available simultaneously), or it may
21be read I<as is>: either as F<README.os2>, or F<pod/perlos2.pod>.
22
23To read the F<.INF> version of documentation (B<very> recommended)
24outside of OS/2, one needs an IBM's reader (may be available on IBM
25ftp sites (?)  (URL anyone?)) or shipped with PC DOS 7.0 and IBM's
26Visual Age C++ 3.5.
27
28A copy of a Win* viewer is contained in the "Just add OS/2 Warp" package
29
30  ftp://ftp.software.ibm.com/ps/products/os2/tools/jaow/jaow.zip
31
32in F<?:\JUST_ADD\view.exe>. This gives one an access to EMX's
33F<.INF> docs as well (text form is available in F</emx/doc> in
34EMX's distribution).  There is also a different viewer named xview.
35
36Note that if you have F<lynx.exe> or F<netscape.exe> installed, you can follow WWW links
37from this document in F<.INF> format. If you have EMX docs installed
38correctly, you can follow library links (you need to have C<view emxbook>
39working by setting C<EMXBOOK> environment variable as it is described
40in EMX docs).
41
42=cut
43
44Contents (This may be a little bit obsolete)
45
46 perlos2 - Perl under OS/2, DOS, Win0.3*, Win0.95 and WinNT.
47
48      NAME
49      SYNOPSIS
50      DESCRIPTION
51	 -  Target
52	 -  Other OSes
53	 -  Prerequisites
54	 -  Starting Perl programs under OS/2 (and DOS and...)
55	 -  Starting OS/2 (and DOS) programs under Perl
56      Frequently asked questions
57	 -  "It does not work"
58	 -  I cannot run external programs
59	 -  I cannot embed perl into my program, or use perl.dll from my
60	 -  `` and pipe-open do not work under DOS.
61	 -  Cannot start find.exe "pattern" file
62      INSTALLATION
63	 -  Automatic binary installation
64	 -  Manual binary installation
65	 -  Warning
66      Accessing documentation
67	 -  OS/2 .INF file
68	 -  Plain text
69	 -  Manpages
70	 -  HTML
71	 -  GNU info files
72	 -  PDF files
73	 -  LaTeX docs
74      BUILD
75	 -  The short story
76	 -  Prerequisites
77	 -  Getting perl source
78	 -  Application of the patches
79	 -  Hand-editing
80	 -  Making
81	 -  Testing
82	 -  Installing the built perl
83	 -  a.out-style build
84      Build FAQ
85	 -  Some / became \ in pdksh.
86	 -  'errno' - unresolved external
87	 -  Problems with tr or sed
88	 -  Some problem (forget which ;-)
89	 -  Library ... not found
90	 -  Segfault in make
91	 -  op/sprintf test failure
92      Specific (mis)features of OS/2 port
93	 -  setpriority, getpriority
94	 -  system()
95	 -  extproc on the first line
96	 -  Additional modules:
97	 -  Prebuilt methods:
98	 -  Prebuilt variables:
99	 -  Misfeatures
100	 -  Modifications
101	 -  Identifying DLLs
102	 -  Centralized management of resources
103      Perl flavors
104	 -  perl.exe
105	 -  perl_.exe
106	 -  perl__.exe
107	 -  perl___.exe
108	 -  Why strange names?
109	 -  Why dynamic linking?
110	 -  Why chimera build?
111      ENVIRONMENT
112	 -  PERLLIB_PREFIX
113	 -  PERL_BADLANG
114	 -  PERL_BADFREE
115	 -  PERL_SH_DIR
116	 -  USE_PERL_FLOCK
117	 -  TMP or TEMP
118      Evolution
119	 -  Text-mode filehandles
120	 -  Priorities
121	 -  DLL name mangling: pre 5.6.2
122	 -  DLL name mangling: 5.6.2 and beyond
123	 -  DLL forwarder generation
124	 -  Threading
125	 -  Calls to external programs
126	 -  Memory allocation
127	 -  Threads
128      BUGS
129      AUTHOR
130      SEE ALSO
131
132=head1 DESCRIPTION
133
134=head2 Target
135
136The target is to make OS/2 one of the best supported platform for
137using/building/developing Perl and I<Perl applications>, as well as
138make Perl the best language to use under OS/2. The secondary target is
139to try to make this work under DOS and Win* as well (but not B<too> hard).
140
141The current state is quite close to this target. Known limitations:
142
143=over 5
144
145=item *
146
147Some *nix programs use fork() a lot; with the mostly useful flavors of
148perl for OS/2 (there are several built simultaneously) this is
149supported; but some flavors do not support this (e.g., when Perl is
150called from inside REXX).  Using fork() after
151I<use>ing dynamically loading extensions would not work with I<very> old
152versions of EMX.
153
154=item *
155
156You need a separate perl executable F<perl__.exe> (see L</perl__.exe>)
157if you want to use PM code in your application (as Perl/Tk or OpenGL
158Perl modules do) without having a text-mode window present.
159
160While using the standard F<perl.exe> from a text-mode window is possible
161too, I have seen cases when this causes degradation of the system stability.
162Using F<perl__.exe> avoids such a degradation.
163
164=item *
165
166There is no simple way to access WPS objects. The only way I know
167is via C<OS2::REXX> and C<SOM> extensions (see L<OS2::REXX>, L<SOM>).
168However, we do not have access to
169convenience methods of Object-REXX. (Is it possible at all? I know
170of no Object-REXX API.)  The C<SOM> extension (currently in alpha-text)
171may eventually remove this shortcoming; however, due to the fact that
172DII is not supported by the C<SOM> module, using C<SOM> is not as
173convenient as one would like it.
174
175=back
176
177Please keep this list up-to-date by informing me about other items.
178
179=head2 Other OSes
180
181Since OS/2 port of perl uses a remarkable EMX environment, it can
182run (and build extensions, and - possibly - be built itself) under any
183environment which can run EMX. The current list is DOS,
184DOS-inside-OS/2, Win0.3*, Win0.95 and WinNT. Out of many perl flavors,
185only one works, see L</"F<perl_.exe>">.
186
187Note that not all features of Perl are available under these
188environments. This depends on the features the I<extender> - most
189probably RSX - decided to implement.
190
191Cf. L</Prerequisites>.
192
193=head2 Prerequisites
194
195=over 6
196
197=item EMX
198
199EMX runtime is required (may be substituted by RSX). Note that
200it is possible to make F<perl_.exe> to run under DOS without any
201external support by binding F<emx.exe>/F<rsx.exe> to it, see L<emxbind(1)>.
202Note that under DOS for best results one should use RSX runtime, which
203has much more functions working (like C<fork>, C<popen> and so on). In
204fact RSX is required if there is no VCPI present. Note the
205RSX requires DPMI.  Many implementations of DPMI are known to be very
206buggy, beware!
207
208Only the latest runtime is supported, currently C<0.9d fix 03>. Perl may run
209under earlier versions of EMX, but this is not tested.
210
211One can get different parts of EMX from, say
212
213  ftp://crydee.sai.msu.ru/pub/comp/os/os2/leo/gnu/emx+gcc/
214  http://hobbes.nmsu.edu/h-browse.php?dir=/pub/os2/dev/emx/v0.9d/
215
216The runtime component should have the name F<emxrt.zip>.
217
218B<NOTE>. When using F<emx.exe>/F<rsx.exe>, it is enough to have them on your path. One
219does not need to specify them explicitly (though this
220
221  emx perl_.exe -de 0
222
223will work as well.)
224
225=item RSX
226
227To run Perl on DPMI platforms one needs RSX runtime. This is
228needed under DOS-inside-OS/2, Win0.3*, Win0.95 and WinNT (see
229L</"Other OSes">). RSX would not work with VCPI
230only, as EMX would, it requires DMPI.
231
232Having RSX and the latest F<sh.exe> one gets a fully functional
233B<*nix>-ish environment under DOS, say, C<fork>, C<``> and
234pipe-C<open> work. In fact, MakeMaker works (for static build), so one
235can have Perl development environment under DOS.
236
237One can get RSX from, say
238
239  http://cd.textfiles.com/hobbesos29804/disk1/EMX09C/
240  ftp://crydee.sai.msu.ru/pub/comp/os/os2/leo/gnu/emx+gcc/contrib/
241
242Contact the author on C<rainer@mathematik.uni-bielefeld.de>.
243
244The latest F<sh.exe> with DOS hooks is available in
245
246  http://www.ilyaz.org/software/os2/
247
248as F<sh_dos.zip> or under similar names starting with C<sh>, C<pdksh> etc.
249
250=item HPFS
251
252Perl does not care about file systems, but the perl library contains
253many files with long names, so to install it intact one needs a file
254system which supports long file names.
255
256Note that if you do not plan to build the perl itself, it may be
257possible to fool EMX to truncate file names. This is not supported,
258read EMX docs to see how to do it.
259
260=item pdksh
261
262To start external programs with complicated command lines (like with
263pipes in between, and/or quoting of arguments), Perl uses an external
264shell. With EMX port such shell should be named F<sh.exe>, and located
265either in the wired-in-during-compile locations (usually F<F:/bin>),
266or in configurable location (see L</"C<PERL_SH_DIR>">).
267
268For best results use EMX pdksh. The standard binary (5.2.14 or later) runs
269under DOS (with L</RSX>) as well, see
270
271  http://www.ilyaz.org/software/os2/
272
273=back
274
275=head2 Starting Perl programs under OS/2 (and DOS and...)
276
277Start your Perl program F<foo.pl> with arguments C<arg1 arg2 arg3> the
278same way as on any other platform, by
279
280	perl foo.pl arg1 arg2 arg3
281
282If you want to specify perl options C<-my_opts> to the perl itself (as
283opposed to your program), use
284
285	perl -my_opts foo.pl arg1 arg2 arg3
286
287Alternately, if you use OS/2-ish shell, like CMD or 4os2, put
288the following at the start of your perl script:
289
290	extproc perl -S -my_opts
291
292rename your program to F<foo.cmd>, and start it by typing
293
294	foo arg1 arg2 arg3
295
296Note that because of stupid OS/2 limitations the full path of the perl
297script is not available when you use C<extproc>, thus you are forced to
298use C<-S> perl switch, and your script should be on the C<PATH>. As a plus
299side, if you know a full path to your script, you may still start it
300with
301
302	perl ../../blah/foo.cmd arg1 arg2 arg3
303
304(note that the argument C<-my_opts> is taken care of by the C<extproc> line
305in your script, see C<L</extproc>> on the first line).
306
307To understand what the above I<magic> does, read perl docs about C<-S>
308switch - see L<perlrun>, and cmdref about C<extproc>:
309
310	view perl perlrun
311	man perlrun
312	view cmdref extproc
313	help extproc
314
315or whatever method you prefer.
316
317There are also endless possibilities to use I<executable extensions> of
3184os2, I<associations> of WPS and so on... However, if you use
319*nixish shell (like F<sh.exe> supplied in the binary distribution),
320you need to follow the syntax specified in L<perlrun/"Command Switches">.
321
322Note that B<-S> switch supports scripts with additional extensions
323F<.cmd>, F<.btm>, F<.bat>, F<.pl> as well.
324
325=head2 Starting OS/2 (and DOS) programs under Perl
326
327This is what system() (see L<perlfunc/system>), C<``> (see
328L<perlop/"I/O Operators">), and I<open pipe> (see L<perlfunc/open>)
329are for. (Avoid exec() (see L<perlfunc/exec>) unless you know what you
330do).
331
332Note however that to use some of these operators you need to have a
333sh-syntax shell installed (see L</"Pdksh">,
334L</"Frequently asked questions">), and perl should be able to find it
335(see L</"C<PERL_SH_DIR>">).
336
337The cases when the shell is used are:
338
339=over
340
341=item 1
342
343One-argument system() (see L<perlfunc/system>), exec() (see L<perlfunc/exec>)
344with redirection or shell meta-characters;
345
346=item 2
347
348Pipe-open (see L<perlfunc/open>) with the command which contains redirection
349or shell meta-characters;
350
351=item 3
352
353Backticks C<``> (see L<perlop/"I/O Operators">) with the command which contains
354redirection or shell meta-characters;
355
356=item 4
357
358If the executable called by system()/exec()/pipe-open()/C<``> is a script
359with the "magic" C<#!> line or C<extproc> line which specifies shell;
360
361=item 5
362
363If the executable called by system()/exec()/pipe-open()/C<``> is a script
364without "magic" line, and C<$ENV{EXECSHELL}> is set to shell;
365
366=item 6
367
368If the executable called by system()/exec()/pipe-open()/C<``> is not
369found (is not this remark obsolete?);
370
371=item 7
372
373For globbing (see L<perlfunc/glob>, L<perlop/"I/O Operators">)
374(obsolete? Perl uses builtin globbing nowadays...).
375
376=back
377
378For the sake of speed for a common case, in the above algorithms
379backslashes in the command name are not considered as shell metacharacters.
380
381Perl starts scripts which begin with cookies
382C<extproc> or C<#!> directly, without an intervention of shell.  Perl uses the
383same algorithm to find the executable as F<pdksh>: if the path
384on C<#!> line does not work, and contains C</>, then the directory
385part of the executable is ignored, and the executable
386is searched in F<.> and on C<PATH>.  To find arguments for these scripts
387Perl uses a different algorithm than F<pdksh>: up to 3 arguments are
388recognized, and trailing whitespace is stripped.
389
390If a script
391does not contain such a cooky, then to avoid calling F<sh.exe>, Perl uses
392the same algorithm as F<pdksh>: if C<$ENV{EXECSHELL}> is set, the
393script is given as the first argument to this command, if not set, then
394C<$ENV{COMSPEC} /c> is used (or a hardwired guess if C<$ENV{COMSPEC}> is
395not set).
396
397When starting scripts directly, Perl uses exactly the same algorithm as for
398the search of script given by B<-S> command-line option: it will look in
399the current directory, then on components of C<$ENV{PATH}> using the
400following order of appended extensions: no extension, F<.cmd>, F<.btm>,
401F<.bat>, F<.pl>.
402
403Note that Perl will start to look for scripts only if OS/2 cannot start the
404specified application, thus C<system 'blah'> will not look for a script if
405there is an executable file F<blah.exe> I<anywhere> on C<PATH>.  In
406other words, C<PATH> is essentially searched twice: once by the OS for
407an executable, then by Perl for scripts.
408
409Note also that executable files on OS/2 can have an arbitrary extension, but
410F<.exe> will be automatically appended if no dot is present in the name.  The
411workaround is as simple as that:  since F<blah.> and F<blah> denote the same
412file (at list on FAT and HPFS file systems), to start an executable residing in
413file F<n:/bin/blah> (no extension) give an argument C<n:/bin/blah.> (dot
414appended) to system().
415
416Perl will start PM programs from VIO (=text-mode) Perl process in a
417separate PM session;
418the opposite is not true: when you start a non-PM program from a PM
419Perl process, Perl would not run it in a separate session.  If a separate
420session is desired, either ensure
421that shell will be used, as in C<system 'cmd /c myprog'>, or start it using
422optional arguments to system() documented in C<OS2::Process> module.  This
423is considered to be a feature.
424
425=head1 Frequently asked questions
426
427=head2 "It does not work"
428
429Perl binary distributions come with a F<testperl.cmd> script which tries
430to detect common problems with misconfigured installations.  There is a
431pretty large chance it will discover which step of the installation you
432managed to goof.  C<;-)>
433
434=head2 I cannot run external programs
435
436=over 4
437
438=item *
439
440Did you run your programs with C<-w> switch? See
441L</Starting OSE<sol>2 (and DOS) programs under Perl>.
442
443=item *
444
445Do you try to run I<internal> shell commands, like C<`copy a b`>
446(internal for F<cmd.exe>), or C<`glob a*b`> (internal for ksh)? You
447need to specify your shell explicitly, like C<`cmd /c copy a b`>,
448since Perl cannot deduce which commands are internal to your shell.
449
450=back
451
452=head2 I cannot embed perl into my program, or use F<perl.dll> from my
453program.
454
455=over 4
456
457=item Is your program EMX-compiled with C<-Zmt -Zcrtdll>?
458
459Well, nowadays Perl DLL should be usable from a differently compiled
460program too...  If you can run Perl code from REXX scripts (see
461L<OS2::REXX>), then there are some other aspect of interaction which
462are overlooked by the current hackish code to support
463differently-compiled principal programs.
464
465If everything else fails, you need to build a stand-alone DLL for
466perl. Contact me, I did it once. Sockets would not work, as a lot of
467other stuff.
468
469=item Did you use L<ExtUtils::Embed>?
470
471Some time ago I had reports it does not work.  Nowadays it is checked
472in the Perl test suite, so grep F<./t> subdirectory of the build tree
473(as well as F<*.t> files in the F<./lib> subdirectory) to find how it
474should be done "correctly".
475
476=back
477
478=head2 C<``> and pipe-C<open> do not work under DOS.
479
480This may a variant of just L</"I cannot run external programs">, or a
481deeper problem. Basically: you I<need> RSX (see L</Prerequisites>)
482for these commands to work, and you may need a port of F<sh.exe> which
483understands command arguments. One of such ports is listed in
484L</Prerequisites> under RSX. Do not forget to set variable
485L</"C<PERL_SH_DIR>"> as well.
486
487DPMI is required for RSX.
488
489=head2 Cannot start C<find.exe "pattern" file>
490
491The whole idea of the "standard C API to start applications" is that
492the forms C<foo> and C<"foo"> of program arguments are completely
493interchangeable.  F<find> breaks this paradigm;
494
495  find "pattern" file
496  find pattern file
497
498are not equivalent; F<find> cannot be started directly using the above
499API.  One needs a way to surround the doublequotes in some other
500quoting construction, necessarily having an extra non-Unixish shell in
501between.
502
503Use one of
504
505  system 'cmd', '/c', 'find "pattern" file';
506  `cmd /c 'find "pattern" file'`
507
508This would start F<find.exe> via F<cmd.exe> via C<sh.exe> via
509C<perl.exe>, but this is a price to pay if you want to use
510non-conforming program.
511
512=head1 INSTALLATION
513
514=head2 Automatic binary installation
515
516The most convenient way of installing a binary distribution of perl is via perl installer
517F<install.exe>. Just follow the instructions, and 99% of the
518installation blues would go away.
519
520Note however, that you need to have F<unzip.exe> on your path, and
521EMX environment I<running>. The latter means that if you just
522installed EMX, and made all the needed changes to F<Config.sys>,
523you may need to reboot in between. Check EMX runtime by running
524
525	emxrev
526
527Binary installer also creates a folder on your desktop with some useful
528objects.  If you need to change some aspects of the work of the binary
529installer, feel free to edit the file F<Perl.pkg>.  This may be useful
530e.g., if you need to run the installer many times and do not want to
531make many interactive changes in the GUI.
532
533B<Things not taken care of by automatic binary installation:>
534
535=over 15
536
537=item C<PERL_BADLANG>
538
539may be needed if you change your codepage I<after> perl installation,
540and the new value is not supported by EMX. See L</"C<PERL_BADLANG>">.
541
542=item C<PERL_BADFREE>
543
544see L</"C<PERL_BADFREE>">.
545
546=item F<Config.pm>
547
548This file resides somewhere deep in the location you installed your
549perl library, find it out by
550
551  perl -MConfig -le "print $INC{'Config.pm'}"
552
553While most important values in this file I<are> updated by the binary
554installer, some of them may need to be hand-edited. I know no such
555data, please keep me informed if you find one.  Moreover, manual
556changes to the installed version may need to be accompanied by an edit
557of this file.
558
559=back
560
561B<NOTE>. Because of a typo the binary installer of 5.00305
562would install a variable C<PERL_SHPATH> into F<Config.sys>. Please
563remove this variable and put C<L</PERL_SH_DIR>> instead.
564
565=head2 Manual binary installation
566
567As of version 5.00305, OS/2 perl binary distribution comes split
568into 11 components. Unfortunately, to enable configurable binary
569installation, the file paths in the zip files are not absolute, but
570relative to some directory.
571
572Note that the extraction with the stored paths is still necessary
573(default with unzip, specify C<-d> to pkunzip). However, you
574need to know where to extract the files. You need also to manually
575change entries in F<Config.sys> to reflect where did you put the
576files. Note that if you have some primitive unzipper (like
577C<pkunzip>), you may get a lot of warnings/errors during
578unzipping. Upgrade to C<(w)unzip>.
579
580Below is the sample of what to do to reproduce the configuration on my
581machine.  In F<VIEW.EXE> you can press C<Ctrl-Insert> now, and
582cut-and-paste from the resulting file - created in the directory you
583started F<VIEW.EXE> from.
584
585For each component, we mention environment variables related to each
586installation directory.  Either choose directories to match your
587values of the variables, or create/append-to variables to take into
588account the directories.
589
590=over 3
591
592=item Perl VIO and PM executables (dynamically linked)
593
594  unzip perl_exc.zip *.exe *.ico -d f:/emx.add/bin
595  unzip perl_exc.zip *.dll -d f:/emx.add/dll
596
597(have the directories with C<*.exe> on PATH, and C<*.dll> on
598LIBPATH);
599
600=item Perl_ VIO executable (statically linked)
601
602  unzip perl_aou.zip -d f:/emx.add/bin
603
604(have the directory on PATH);
605
606=item Executables for Perl utilities
607
608  unzip perl_utl.zip -d f:/emx.add/bin
609
610(have the directory on PATH);
611
612=item Main Perl library
613
614  unzip perl_mlb.zip -d f:/perllib/lib
615
616If this directory is exactly the same as the prefix which was compiled
617into F<perl.exe>, you do not need to change
618anything. However, for perl to find the library if you use a different
619path, you need to
620C<set PERLLIB_PREFIX> in F<Config.sys>, see L</"C<PERLLIB_PREFIX>">.
621
622=item Additional Perl modules
623
624  unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.38.2/
625
626Same remark as above applies.  Additionally, if this directory is not
627one of directories on @INC (and @INC is influenced by C<PERLLIB_PREFIX>), you
628need to put this
629directory and subdirectory F<./os2> in C<PERLLIB> or C<PERL5LIB>
630variable. Do not use C<PERL5LIB> unless you have it set already. See
631L<perl/"ENVIRONMENT">.
632
633B<[Check whether this extraction directory is still applicable with
634the new directory structure layout!]>
635
636=item Tools to compile Perl modules
637
638  unzip perl_blb.zip -d f:/perllib/lib
639
640Same remark as for F<perl_ste.zip>.
641
642=item Manpages for Perl and utilities
643
644  unzip perl_man.zip -d f:/perllib/man
645
646This directory should better be on C<MANPATH>. You need to have a
647working F<man> to access these files.
648
649=item Manpages for Perl modules
650
651  unzip perl_mam.zip -d f:/perllib/man
652
653This directory should better be on C<MANPATH>. You need to have a
654working man to access these files.
655
656=item Source for Perl documentation
657
658  unzip perl_pod.zip -d f:/perllib/lib
659
660This is used by the C<perldoc> program (see L<perldoc>), and may be used to
661generate HTML documentation usable by WWW browsers, and
662documentation in zillions of other formats: C<info>, C<LaTeX>,
663C<Acrobat>, C<FrameMaker> and so on.  [Use programs such as
664F<pod2latex> etc.]
665
666=item Perl manual in F<.INF> format
667
668  unzip perl_inf.zip -d d:/os2/book
669
670This directory should better be on C<BOOKSHELF>.
671
672=item Pdksh
673
674  unzip perl_sh.zip -d f:/bin
675
676This is used by perl to run external commands which explicitly
677require shell, like the commands using I<redirection> and I<shell
678metacharacters>. It is also used instead of explicit F</bin/sh>.
679
680Set C<PERL_SH_DIR> (see L</"C<PERL_SH_DIR>">) if you move F<sh.exe> from
681the above location.
682
683B<Note.> It may be possible to use some other sh-compatible shell (untested).
684
685=back
686
687After you installed the components you needed and updated the
688F<Config.sys> correspondingly, you need to hand-edit
689F<Config.pm>. This file resides somewhere deep in the location you
690installed your perl library, find it out by
691
692  perl -MConfig -le "print $INC{'Config.pm'}"
693
694You need to correct all the entries which look like file paths (they
695currently start with C<f:/>).
696
697=head2 B<Warning>
698
699The automatic and manual perl installation leave precompiled paths
700inside perl executables. While these paths are overwritable (see
701L</"C<PERLLIB_PREFIX>">, L</"C<PERL_SH_DIR>">), some people may prefer
702binary editing of paths inside the executables/DLLs.
703
704=head1 Accessing documentation
705
706Depending on how you built/installed perl you may have (otherwise
707identical) Perl documentation in the following formats:
708
709=head2 OS/2 F<.INF> file
710
711Most probably the most convenient form. Under OS/2 view it as
712
713  view perl
714  view perl perlfunc
715  view perl less
716  view perl ExtUtils::MakeMaker
717
718(currently the last two may hit a wrong location, but this may improve
719soon). Under Win* see L</"SYNOPSIS">.
720
721If you want to build the docs yourself, and have I<OS/2 toolkit>, run
722
723	pod2ipf > perl.ipf
724
725in F</perllib/lib/pod> directory, then
726
727	ipfc /inf perl.ipf
728
729(Expect a lot of errors during the both steps.) Now move it on your
730BOOKSHELF path.
731
732=head2 Plain text
733
734If you have perl documentation in the source form, perl utilities
735installed, and GNU groff installed, you may use
736
737	perldoc perlfunc
738	perldoc less
739	perldoc ExtUtils::MakeMaker
740
741to access the perl documentation in the text form (note that you may get
742better results using perl manpages).
743
744Alternately, try running pod2text on F<.pod> files.
745
746=head2 Manpages
747
748If you have F<man> installed on your system, and you installed perl
749manpages, use something like this:
750
751	man perlfunc
752	man 3 less
753	man ExtUtils.MakeMaker
754
755to access documentation for different components of Perl. Start with
756
757	man perl
758
759Note that dot (F<.>) is used as a package separator for documentation
760for packages, and as usual, sometimes you need to give the section - C<3>
761above - to avoid shadowing by the I<less(1) manpage>.
762
763Make sure that the directory B<above> the directory with manpages is
764on our C<MANPATH>, like this
765
766  set MANPATH=c:/man;f:/perllib/man
767
768for Perl manpages in C<f:/perllib/man/man1/> etc.
769
770=head2 HTML
771
772If you have some WWW browser available, installed the Perl
773documentation in the source form, and Perl utilities, you can build
774HTML docs. Cd to directory with F<.pod> files, and do like this
775
776	cd f:/perllib/lib/pod
777	pod2html
778
779After this you can direct your browser the file F<perl.html> in this
780directory, and go ahead with reading docs, like this:
781
782	explore file:///f:/perllib/lib/pod/perl.html
783
784Alternatively you may be able to get these docs prebuilt from CPAN.
785
786=head2 GNU C<info> files
787
788Users of Emacs would appreciate it very much, especially with
789C<CPerl> mode loaded. You need to get latest C<pod2texi> from C<CPAN>,
790or, alternately, the prebuilt info pages.
791
792=head2 F<PDF> files
793
794for C<Acrobat> are available on CPAN (may be for slightly older version of
795perl).
796
797=head2 C<LaTeX> docs
798
799can be constructed using C<pod2latex>.
800
801=head1 BUILD
802
803Here we discuss how to build Perl under OS/2.
804
805=head2 The short story
806
807Assume that you are a seasoned porter, so are sure that all the necessary
808tools are already present on your system, and you know how to get the Perl
809source distribution.  Untar it, change to the extract directory, and
810
811  gnupatch -p0 < os2\diff.configure
812  sh Configure -des -D prefix=f:/perllib
813  make
814  make test
815  make install
816  make aout_test
817  make aout_install
818
819This puts the executables in f:/perllib/bin.  Manually move them to the
820C<PATH>, manually move the built F<perl*.dll> to C<LIBPATH> (here for
821Perl DLL F<*> is a not-very-meaningful hex checksum), and run
822
823  make installcmd INSTALLCMDDIR=d:/ir/on/path
824
825Assuming that the C<man>-files were put on an appropriate location,
826this completes the installation of minimal Perl system.  (The binary
827distribution contains also a lot of additional modules, and the
828documentation in INF format.)
829
830What follows is a detailed guide through these steps.
831
832=head2 Prerequisites
833
834You need to have the latest EMX development environment, the full
835GNU tool suite (gawk renamed to awk, and GNU F<find.exe>
836earlier on path than the OS/2 F<find.exe>, same with F<sort.exe>, to
837check use
838
839  find --version
840  sort --version
841
842). You need the latest version of F<pdksh> installed as F<sh.exe>.
843
844Check that you have B<BSD> libraries and headers installed, and -
845optionally - Berkeley DB headers and libraries, and crypt.
846
847Possible locations to get the files:
848
849
850  ftp://ftp.uni-heidelberg.de/pub/os2/unix/
851  http://hobbes.nmsu.edu/h-browse.php?dir=/pub/os2
852  http://cd.textfiles.com/hobbesos29804/disk1/DEV32/
853  http://cd.textfiles.com/hobbesos29804/disk1/EMX09C/
854
855It is reported that the following archives contain enough utils to
856build perl: F<gnufutil.zip>, F<gnusutil.zip>, F<gnututil.zip>, F<gnused.zip>,
857F<gnupatch.zip>, F<gnuawk.zip>, F<gnumake.zip>, F<gnugrep.zip>, F<bsddev.zip> and
858F<ksh527rt.zip> (or a later version).  Note that all these utilities are
859known to be available from LEO:
860
861  ftp://crydee.sai.msu.ru/pub/comp/os/os2/leo/gnu/
862
863Note also that the F<db.lib> and F<db.a> from the EMX distribution
864are not suitable for multi-threaded compile (even single-threaded
865flavor of Perl uses multi-threaded C RTL, for
866compatibility with XFree86-OS/2). Get a corrected one from
867
868  http://www.ilyaz.org/software/os2/db_mt.zip
869
870If you have I<exactly the same version of Perl> installed already,
871make sure that no copies or perl are currently running.  Later steps
872of the build may fail since an older version of F<perl.dll> loaded into
873memory may be found.  Running C<make test> becomes meaningless, since
874the test are checking a previous build of perl (this situation is detected
875and reported by F<os2/os2_base.t> test).  Do not forget to unset
876C<PERL_EMXLOAD_SEC> in environment.
877
878Also make sure that you have F</tmp> directory on the current drive,
879and F<.> directory in your C<LIBPATH>. One may try to correct the
880latter condition by
881
882  set BEGINLIBPATH .\.
883
884if you use something like F<CMD.EXE> or latest versions of
885F<4os2.exe>.  (Setting BEGINLIBPATH to just C<.> is ignored by the
886OS/2 kernel.)
887
888Make sure your gcc is good for C<-Zomf> linking: run C<omflibs>
889script in F</emx/lib> directory.
890
891Check that you have link386 installed. It comes standard with OS/2,
892but may be not installed due to customization. If typing
893
894  link386
895
896shows you do not have it, do I<Selective install>, and choose C<Link
897object modules> in I<Optional system utilities/More>. If you get into
898link386 prompts, press C<Ctrl-C> to exit.
899
900=head2 Getting perl source
901
902You need to fetch the latest perl source (including developers
903releases). With some probability it is located in
904
905  http://www.cpan.org/src/
906  http://www.cpan.org/src/unsupported
907
908If not, you may need to dig in the indices to find it in the directory
909of the current maintainer.
910
911Quick cycle of developers release may break the OS/2 build time to
912time, looking into
913
914  http://www.cpan.org/ports/os2/
915
916may indicate the latest release which was publicly released by the
917maintainer. Note that the release may include some additional patches
918to apply to the current source of perl.
919
920Extract it like this
921
922  tar vzxf perl5.00409.tar.gz
923
924You may see a message about errors while extracting F<Configure>. This is
925because there is a conflict with a similarly-named file F<configure>.
926
927Change to the directory of extraction.
928
929=head2 Application of the patches
930
931You need to apply the patches in F<./os2/diff.*> like this:
932
933  gnupatch -p0 < os2\diff.configure
934
935You may also need to apply the patches supplied with the binary
936distribution of perl.  It also makes sense to look on the
937perl5-porters mailing list for the latest OS/2-related patches (see
938L<http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/>).  Such
939patches usually contain strings C</os2/> and C<patch>, so it makes
940sense looking for these strings.
941
942=head2 Hand-editing
943
944You may look into the file F<./hints/os2.sh> and correct anything
945wrong you find there. I do not expect it is needed anywhere.
946
947=head2 Making
948
949  sh Configure -des -D prefix=f:/perllib
950
951C<prefix> means: where to install the resulting perl library. Giving
952correct prefix you may avoid the need to specify C<PERLLIB_PREFIX>,
953see L</"C<PERLLIB_PREFIX>">.
954
955I<Ignore the message about missing C<ln>, and about C<-c> option to
956tr>. The latter is most probably already fixed, if you see it and can trace
957where the latter spurious warning comes from, please inform me.
958
959Now
960
961  make
962
963At some moment the built may die, reporting a I<version mismatch> or
964I<unable to run F<perl>>.  This means that you do not have F<.> in
965your LIBPATH, so F<perl.exe> cannot find the needed F<perl67B2.dll> (treat
966these hex digits as line noise).  After this is fixed the build
967should finish without a lot of fuss.
968
969=head2 Testing
970
971Now run
972
973  make test
974
975All tests should succeed (with some of them skipped).  If you have the
976same version of Perl installed, it is crucial that you have C<.> early
977in your LIBPATH (or in BEGINLIBPATH), otherwise your tests will most
978probably test the wrong version of Perl.
979
980Some tests may generate extra messages similar to
981
982=over 4
983
984=item A lot of C<bad free>
985
986in database tests related to Berkeley DB. I<This should be fixed already.>
987If it persists, you may disable this warnings, see L</"C<PERL_BADFREE>">.
988
989=item Process terminated by SIGTERM/SIGINT
990
991This is a standard message issued by OS/2 applications. *nix
992applications die in silence. It is considered to be a feature. One can
993easily disable this by appropriate sighandlers.
994
995However the test engine bleeds these message to screen in unexpected
996moments. Two messages of this kind I<should> be present during
997testing.
998
999=back
1000
1001To get finer test reports, call
1002
1003  perl t/harness
1004
1005The report with F<io/pipe.t> failing may look like this:
1006
1007 Failed Test  Status Wstat Total Fail  Failed  List of failed
1008 ------------------------------------------------------------
1009 io/pipe.t                    12    1   8.33%  9
1010 7 tests skipped, plus 56 subtests skipped.
1011 Failed 1/195 test scripts, 99.49% okay. 1/6542 subtests failed,
1012    99.98% okay.
1013
1014The reasons for most important skipped tests are:
1015
1016=over 8
1017
1018=item F<op/fs.t>
1019
1020=over 4
1021
1022=item Z<>18
1023
1024Checks C<atime> and C<mtime> of C<stat()> - unfortunately, HPFS
1025provides only 2sec time granularity (for compatibility with FAT?).
1026
1027=item Z<>25
1028
1029Checks C<truncate()> on a filehandle just opened for write - I do not
1030know why this should or should not work.
1031
1032=back
1033
1034=item F<op/stat.t>
1035
1036Checks C<stat()>. Tests:
1037
1038=over 4
1039
1040=item 4
1041
1042Checks C<atime> and C<mtime> of C<stat()> - unfortunately, HPFS
1043provides only 2sec time granularity (for compatibility with FAT?).
1044
1045=back
1046
1047=back
1048
1049=head2 Installing the built perl
1050
1051If you haven't yet moved C<perl*.dll> onto LIBPATH, do it now.
1052
1053Run
1054
1055  make install
1056
1057It would put the generated files into needed locations. Manually put
1058F<perl.exe>, F<perl__.exe> and F<perl___.exe> to a location on your
1059PATH, F<perl.dll> to a location on your LIBPATH.
1060
1061Run
1062
1063  make installcmd INSTALLCMDDIR=d:/ir/on/path
1064
1065to convert perl utilities to F<.cmd> files and put them on
1066PATH. You need to put F<.EXE>-utilities on path manually. They are
1067installed in C<$prefix/bin>, here C<$prefix> is what you gave to
1068F<Configure>, see L</Making>.
1069
1070If you use C<man>, either move the installed F<*/man/> directories to
1071your C<MANPATH>, or modify C<MANPATH> to match the location.  (One
1072could have avoided this by providing a correct C<manpath> option to
1073F<./Configure>, or editing F<./config.sh> between configuring and
1074making steps.)
1075
1076=head2 C<a.out>-style build
1077
1078Proceed as above, but make F<perl_.exe> (see L</"F<perl_.exe>">) by
1079
1080  make perl_
1081
1082test and install by
1083
1084  make aout_test
1085  make aout_install
1086
1087Manually put F<perl_.exe> to a location on your PATH.
1088
1089B<Note.> The build process for C<perl_> I<does not know> about all the
1090dependencies, so you should make sure that anything is up-to-date,
1091say, by doing
1092
1093  make perl_dll
1094
1095first.
1096
1097=head1 Building a binary distribution
1098
1099[This section provides a short overview only...]
1100
1101Building should proceed differently depending on whether the version of perl
1102you install is already present and used on your system, or is a new version
1103not yet used.  The description below assumes that the version is new, so
1104installing its DLLs and F<.pm> files will not disrupt the operation of your
1105system even if some intermediate steps are not yet fully working.
1106
1107The other cases require a little bit more convoluted procedures.  Below I
1108suppose that the current version of Perl is C<5.8.2>, so the executables are
1109named accordingly.
1110
1111=over
1112
1113=item 1.
1114
1115Fully build and test the Perl distribution.  Make sure that no tests are
1116failing with C<test> and C<aout_test> targets; fix the bugs in Perl and
1117the Perl test suite detected by these tests.  Make sure that C<all_test>
1118make target runs as clean as possible.  Check that F<os2/perlrexx.cmd>
1119runs fine.
1120
1121=item 2.
1122
1123Fully install Perl, including C<installcmd> target.  Copy the generated DLLs
1124to C<LIBPATH>; copy the numbered Perl executables (as in F<perl5.8.2.exe>)
1125to C<PATH>; copy C<perl_.exe> to C<PATH> as C<perl_5.8.2.exe>.  Think whether
1126you need backward-compatibility DLLs.  In most cases you do not need to install
1127them yet; but sometime this may simplify the following steps.
1128
1129=item 3.
1130
1131Make sure that C<CPAN.pm> can download files from CPAN.  If not, you may need
1132to manually install C<Net::FTP>.
1133
1134=item 4.
1135
1136Install the bundle C<Bundle::OS2_default>
1137
1138 perl5.8.2 -MCPAN -e "install Bundle::OS2_default" < nul |& tee 00cpan_i_1
1139
1140This may take a couple of hours on 1GHz processor (when run the first time).
1141And this should not be necessarily a smooth procedure.  Some modules may not
1142specify required dependencies, so one may need to repeat this procedure several
1143times until the results stabilize.
1144
1145 perl5.8.2 -MCPAN -e "install Bundle::OS2_default" < nul |& tee 00cpan_i_2
1146 perl5.8.2 -MCPAN -e "install Bundle::OS2_default" < nul |& tee 00cpan_i_3
1147
1148Even after they stabilize, some tests may fail.
1149
1150Fix as many discovered bugs as possible.  Document all the bugs which are not
1151fixed, and all the failures with unknown reasons.  Inspect the produced logs
1152F<00cpan_i_1> to find suspiciously skipped tests, and other fishy events.
1153
1154Keep in mind that I<installation> of some modules may fail too: for example,
1155the DLLs to update may be already loaded by F<CPAN.pm>.  Inspect the C<install>
1156logs (in the example above F<00cpan_i_1> etc) for errors, and install things
1157manually, as in
1158
1159  cd $CPANHOME/.cpan/build/Digest-MD5-2.31
1160  make install
1161
1162Some distributions may fail some tests, but you may want to install them
1163anyway (as above, or via C<force install> command of C<CPAN.pm> shell-mode).
1164
1165Since this procedure may take quite a long time to complete, it makes sense
1166to "freeze" your CPAN configuration by disabling periodic updates of the
1167local copy of CPAN index: set C<index_expire> to some big value (I use 365),
1168then save the settings
1169
1170  CPAN> o conf index_expire 365
1171  CPAN> o conf commit
1172
1173Reset back to the default value C<1> when you are finished.
1174
1175=item 5.
1176
1177When satisfied with the results, rerun the C<installcmd> target.  Now you
1178can copy C<perl5.8.2.exe> to C<perl.exe>, and install the other OMF-build
1179executables: C<perl__.exe> etc.  They are ready to be used.
1180
1181=item 6.
1182
1183Change to the C<./pod> directory of the build tree, download the Perl logo
1184F<CamelGrayBig.BMP>, and run
1185
1186  ( perl2ipf > perl.ipf ) |& tee 00ipf
1187  ipfc /INF perl.ipf |& tee 00inf
1188
1189This produces the Perl docs online book C<perl.INF>.  Install in on
1190C<BOOKSHELF> path.
1191
1192=item 7.
1193
1194Now is the time to build statically linked executable F<perl_.exe> which
1195includes newly-installed via C<Bundle::OS2_default> modules.  Doing testing
1196via C<CPAN.pm> is going to be painfully slow, since it statically links
1197a new executable per XS extension.
1198
1199Here is a possible workaround: create a toplevel F<Makefile.PL> in
1200F<$CPANHOME/.cpan/build/> with contents being (compare with L</Making
1201executables with a custom collection of statically loaded extensions>)
1202
1203  use ExtUtils::MakeMaker;
1204  WriteMakefile NAME => 'dummy';
1205
1206execute this as
1207
1208  perl_5.8.2.exe Makefile.PL <nul |& tee 00aout_c1
1209  make -k all test <nul |& 00aout_t1
1210
1211Again, this procedure should not be absolutely smooth.  Some C<Makefile.PL>'s
1212in subdirectories may be buggy, and would not run as "child" scripts.  The
1213interdependency of modules can strike you; however, since non-XS modules
1214are already installed, the prerequisites of most modules have a very good
1215chance to be present.
1216
1217If you discover some glitches, move directories of problematic modules to a
1218different location; if these modules are non-XS modules, you may just ignore
1219them - they are already installed; the remaining, XS, modules you need to
1220install manually one by one.
1221
1222After each such removal you need to rerun the C<Makefile.PL>/C<make> process;
1223usually this procedure converges soon.  (But be sure to convert all the
1224necessary external C libraries from F<.lib> format to F<.a> format: run one of
1225
1226  emxaout foo.lib
1227  emximp -o foo.a foo.lib
1228
1229whichever is appropriate.)  Also, make sure that the DLLs for external
1230libraries are usable with executables compiled without C<-Zmtd> options.
1231
1232When you are sure that only a few subdirectories
1233lead to failures, you may want to add C<-j4> option to C<make> to speed up
1234skipping subdirectories with already finished build.
1235
1236When you are satisfied with the results of tests, install the build C libraries
1237for extensions:
1238
1239  make install |& tee 00aout_i
1240
1241Now you can rename the file F<./perl.exe> generated during the last phase
1242to F<perl_5.8.2.exe>; place it on C<PATH>; if there is an inter-dependency
1243between some XS modules, you may need to repeat the C<test>/C<install> loop
1244with this new executable and some excluded modules - until the procedure
1245converges.
1246
1247Now you have all the necessary F<.a> libraries for these Perl modules in the
1248places where Perl builder can find it.  Use the perl builder: change to an
1249empty directory, create a "dummy" F<Makefile.PL> again, and run
1250
1251  perl_5.8.2.exe Makefile.PL |& tee 00c
1252  make perl		     |& tee 00p
1253
1254This should create an executable F<./perl.exe> with all the statically loaded
1255extensions built in.  Compare the generated F<perlmain.c> files to make sure
1256that during the iterations the number of loaded extensions only increases.
1257Rename F<./perl.exe> to F<perl_5.8.2.exe> on C<PATH>.
1258
1259When it converges, you got a functional variant of F<perl_5.8.2.exe>; copy it
1260to C<perl_.exe>.  You are done with generation of the local Perl installation.
1261
1262=item 8.
1263
1264Make sure that the installed modules are actually installed in the location
1265of the new Perl, and are not inherited from entries of @INC given for
1266inheritance from the older versions of Perl: set C<PERLLIB_582_PREFIX> to
1267redirect the new version of Perl to a new location, and copy the installed
1268files to this new location.  Redo the tests to make sure that the versions of
1269modules inherited from older versions of Perl are not needed.
1270
1271Actually, the log output of L<pod2ipf(1)> during the step 6 gives a very detailed
1272info about which modules are loaded from which place; so you may use it as
1273an additional verification tool.
1274
1275Check that some temporary files did not make into the perl install tree.
1276Run something like this
1277
1278  pfind . -f "!(/\.(pm|pl|ix|al|h|a|lib|txt|pod|imp|bs|dll|ld|bs|inc|xbm|yml|cgi|uu|e2x|skip|packlist|eg|cfg|html|pub|enc|all|ini|po|pot)$/i or /^\w+$/") | less
1279
1280in the install tree (both top one and F<sitelib> one).
1281
1282Compress all the DLLs with F<lxlite>.  The tiny F<.exe> can be compressed with
1283C</c:max> (the bug only appears when there is a fixup in the last 6 bytes of a
1284page (?); since the tiny executables are much smaller than a page, the bug
1285will not hit).  Do not compress C<perl_.exe> - it would not work under DOS.
1286
1287=item 9.
1288
1289Now you can generate the binary distribution.  This is done by running the
1290test of the CPAN distribution C<OS2::SoftInstaller>.  Tune up the file
1291F<test.pl> to suit the layout of current version of Perl first.  Do not
1292forget to pack the necessary external DLLs accordingly.  Include the
1293description of the bugs and test suite failures you could not fix.  Include
1294the small-stack versions of Perl executables from Perl build directory.
1295
1296Include F<perl5.def> so that people can relink the perl DLL preserving
1297the binary compatibility, or can create compatibility DLLs.  Include the diff
1298files (C<diff -pu old new>) of fixes you did so that people can rebuild your
1299version.  Include F<perl5.map> so that one can use remote debugging.
1300
1301=item 10.
1302
1303Share what you did with the other people.  Relax.  Enjoy fruits of your work.
1304
1305=item 11.
1306
1307Brace yourself for thanks, bug reports, hate mail and spam coming as result
1308of the previous step.  No good deed should remain unpunished!
1309
1310=back
1311
1312=head1 Building custom F<.EXE> files
1313
1314The Perl executables can be easily rebuilt at any moment.  Moreover, one can
1315use the I<embedding> interface (see L<perlembed>) to make very customized
1316executables.
1317
1318=head2 Making executables with a custom collection of statically loaded extensions
1319
1320It is a little bit easier to do so while I<decreasing> the list of statically
1321loaded extensions.  We discuss this case only here.
1322
1323=over
1324
1325=item 1.
1326
1327Change to an empty directory, and create a placeholder <Makefile.PL>:
1328
1329  use ExtUtils::MakeMaker;
1330  WriteMakefile NAME => 'dummy';
1331
1332=item 2.
1333
1334Run it with the flavor of Perl (F<perl.exe> or F<perl_.exe>) you want to
1335rebuild.
1336
1337  perl_ Makefile.PL
1338
1339=item 3.
1340
1341Ask it to create new Perl executable:
1342
1343  make perl
1344
1345(you may need to manually add C<PERLTYPE=-DPERL_CORE> to this commandline on
1346some versions of Perl; the symptom is that the command-line globbing does not
1347work from OS/2 shells with the newly-compiled executable; check with
1348
1349  .\perl.exe -wle "print for @ARGV" *
1350
1351).
1352
1353=item 4.
1354
1355The previous step created F<perlmain.c> which contains a list of newXS() calls
1356near the end.  Removing unnecessary calls, and rerunning
1357
1358  make perl
1359
1360will produce a customized executable.
1361
1362=back
1363
1364=head2 Making executables with a custom search-paths
1365
1366The default perl executable is flexible enough to support most usages.
1367However, one may want something yet more flexible; for example, one may want
1368to find Perl DLL relatively to the location of the EXE file; or one may want
1369to ignore the environment when setting the Perl-library search patch, etc.
1370
1371If you fill comfortable with I<embedding> interface (see L<perlembed>), such
1372things are easy to do repeating the steps outlined in L</Making
1373executables with a custom collection of statically loaded extensions>, and
1374doing more comprehensive edits to main() of F<perlmain.c>.  The people with
1375little desire to understand Perl can just rename main(), and do necessary
1376modification in a custom main() which calls the renamed function in appropriate
1377time.
1378
1379However, there is a third way: perl DLL exports the main() function and several
1380callbacks to customize the search path.  Below is a complete example of a
1381"Perl loader" which
1382
1383=over
1384
1385=item 1.
1386
1387Looks for Perl DLL in the directory C<$exedir/../dll>;
1388
1389=item 2.
1390
1391Prepends the above directory to C<BEGINLIBPATH>;
1392
1393=item 3.
1394
1395Fails if the Perl DLL found via C<BEGINLIBPATH> is different from what was
1396loaded on step 1; e.g., another process could have loaded it from C<LIBPATH>
1397or from a different value of C<BEGINLIBPATH>.  In these cases one needs to
1398modify the setting of the system so that this other process either does not
1399run, or loads the DLL from C<BEGINLIBPATH> with C<LIBPATHSTRICT=T> (available
1400with kernels after September 2000).
1401
1402=item 4.
1403
1404Loads Perl library from C<$exedir/../dll/lib/>.
1405
1406=item 5.
1407
1408Uses Bourne shell from C<$exedir/../dll/sh/ksh.exe>.
1409
1410=back
1411
1412For best results compile the C file below with the same options as the Perl
1413DLL.  However, a lot of functionality will work even if the executable is not
1414an EMX applications, e.g., if compiled with
1415
1416  gcc -Wall -DDOSISH -DOS2=1 -O2 -s -Zomf -Zsys perl-starter.c \
1417    -DPERL_DLL_BASENAME=\"perl312F\" -Zstack 8192 -Zlinker /PM:VIO
1418
1419Here is the sample C file:
1420
1421 #define INCL_DOS
1422 #define INCL_NOPM
1423 /* These are needed for compile if os2.h includes os2tk.h, not
1424  * os2emx.h */
1425 #define INCL_DOSPROCESS
1426 #include <os2.h>
1427
1428 #include "EXTERN.h"
1429 #define PERL_IN_MINIPERLMAIN_C
1430 #include "perl.h"
1431
1432 static char *me;
1433 HMODULE handle;
1434
1435 static void
1436 die_with(char *msg1, char *msg2, char *msg3, char *msg4)
1437 {
1438    ULONG c;
1439    char *s = " error: ";
1440
1441    DosWrite(2, me, strlen(me), &c);
1442    DosWrite(2, s, strlen(s), &c);
1443    DosWrite(2, msg1, strlen(msg1), &c);
1444    DosWrite(2, msg2, strlen(msg2), &c);
1445    DosWrite(2, msg3, strlen(msg3), &c);
1446    DosWrite(2, msg4, strlen(msg4), &c);
1447    DosWrite(2, "\r\n", 2, &c);
1448    exit(255);
1449 }
1450
1451 typedef ULONG (*fill_extLibpath_t)(int type,
1452                                    char *pre,
1453                                    char *post,
1454                                    int replace,
1455                                    char *msg);
1456 typedef int (*main_t)(int type, char *argv[], char *env[]);
1457 typedef int (*handler_t)(void* data, int which);
1458
1459 #ifndef PERL_DLL_BASENAME
1460 #  define PERL_DLL_BASENAME "perl"
1461 #endif
1462
1463 static HMODULE
1464 load_perl_dll(char *basename)
1465 {
1466     char buf[300], fail[260];
1467     STRLEN l, dirl;
1468     fill_extLibpath_t f;
1469     ULONG rc_fullname;
1470     HMODULE handle, handle1;
1471
1472     if (_execname(buf, sizeof(buf) - 13) != 0)
1473         die_with("Can't find full path: ", strerror(errno), "", "");
1474     /* XXXX Fill 'me' with new value */
1475     l = strlen(buf);
1476     while (l && buf[l-1] != '/' && buf[l-1] != '\\')
1477         l--;
1478     dirl = l - 1;
1479     strcpy(buf + l, basename);
1480     l += strlen(basename);
1481     strcpy(buf + l, ".dll");
1482     if ( (rc_fullname = DosLoadModule(fail, sizeof fail, buf, &handle))
1483                                                                    != 0
1484          && DosLoadModule(fail, sizeof fail, basename, &handle) != 0 )
1485         die_with("Can't load DLL ", buf, "", "");
1486     if (rc_fullname)
1487         return handle;    /* was loaded with short name; all is fine */
1488     if (DosQueryProcAddr(handle, 0, "fill_extLibpath", (PFN*)&f))
1489         die_with(buf,
1490                  ": DLL exports no symbol ",
1491                  "fill_extLibpath",
1492                  "");
1493     buf[dirl] = 0;
1494     if (f(0 /*BEGINLIBPATH*/, buf /* prepend */, NULL /* append */,
1495           0 /* keep old value */, me))
1496         die_with(me, ": prepending BEGINLIBPATH", "", "");
1497     if (DosLoadModule(fail, sizeof fail, basename, &handle1) != 0)
1498         die_with(me,
1499                  ": finding perl DLL again via BEGINLIBPATH",
1500                  "",
1501                  "");
1502     buf[dirl] = '\\';
1503     if (handle1 != handle) {
1504         if (DosQueryModuleName(handle1, sizeof(fail), fail))
1505             strcpy(fail, "???");
1506         die_with(buf,
1507                  ":\n\tperl DLL via BEGINLIBPATH is different: \n\t",
1508                  fail,
1509                  "\n\tYou may need to manipulate global BEGINLIBPATH"
1510                     " and LIBPATHSTRICT"
1511                     "\n\tso that the other copy is loaded via"
1512                     BEGINLIBPATH.");
1513     }
1514     return handle;
1515 }
1516
1517 int
1518 main(int argc, char **argv, char **env)
1519 {
1520     main_t f;
1521     handler_t h;
1522
1523     me = argv[0];
1524     /**/
1525     handle = load_perl_dll(PERL_DLL_BASENAME);
1526
1527     if (DosQueryProcAddr(handle,
1528                          0,
1529                          "Perl_OS2_handler_install",
1530                          (PFN*)&h))
1531         die_with(PERL_DLL_BASENAME,
1532                  ": DLL exports no symbol ",
1533                  "Perl_OS2_handler_install",
1534                  "");
1535     if ( !h((void *)"~installprefix", Perlos2_handler_perllib_from)
1536          || !h((void *)"~dll", Perlos2_handler_perllib_to)
1537          || !h((void *)"~dll/sh/ksh.exe", Perlos2_handler_perl_sh) )
1538         die_with(PERL_DLL_BASENAME,
1539                  ": Can't install @INC manglers",
1540                  "",
1541                  "");
1542     if (DosQueryProcAddr(handle, 0, "dll_perlmain", (PFN*)&f))
1543         die_with(PERL_DLL_BASENAME,
1544                  ": DLL exports no symbol ",
1545                  "dll_perlmain",
1546                  "");
1547     return f(argc, argv, env);
1548 }
1549
1550=head1 Build FAQ
1551
1552=head2 Some C</> became C<\> in pdksh.
1553
1554You have a very old pdksh. See L</Prerequisites>.
1555
1556=head2 C<'errno'> - unresolved external
1557
1558You do not have MT-safe F<db.lib>. See L</Prerequisites>.
1559
1560=head2 Problems with tr or sed
1561
1562reported with very old version of tr and sed.
1563
1564=head2 Some problem (forget which ;-)
1565
1566You have an older version of F<perl.dll> on your LIBPATH, which
1567broke the build of extensions.
1568
1569=head2 Library ... not found
1570
1571You did not run C<omflibs>. See L</Prerequisites>.
1572
1573=head2 Segfault in make
1574
1575You use an old version of GNU make. See L</Prerequisites>.
1576
1577=head2 op/sprintf test failure
1578
1579This can result from a bug in emx sprintf which was fixed in 0.9d fix 03.
1580
1581=head1 Specific (mis)features of OS/2 port
1582
1583=head2 C<setpriority>, C<getpriority>
1584
1585Note that these functions are compatible with *nix, not with the older
1586ports of '94 - 95. The priorities are absolute, go from 32 to -95,
1587lower is quicker. 0 is the default priority.
1588
1589B<WARNING>.  Calling C<getpriority> on a non-existing process could lock
1590the system before Warp3 fixpak22.  Starting with Warp3, Perl will use
1591a workaround: it aborts getpriority() if the process is not present.
1592This is not possible on older versions C<2.*>, and has a race
1593condition anyway.
1594
1595=head2 C<system()>
1596
1597Multi-argument form of C<system()> allows an additional numeric
1598argument. The meaning of this argument is described in
1599L<OS2::Process>.
1600
1601When finding a program to run, Perl first asks the OS to look for executables
1602on C<PATH> (OS/2 adds extension F<.exe> if no extension is present).
1603If not found, it looks for a script with possible extensions
1604added in this order: no extension, F<.cmd>, F<.btm>,
1605F<.bat>, F<.pl>.  If found, Perl checks the start of the file for magic
1606strings C<"#!"> and C<"extproc ">.  If found, Perl uses the rest of the
1607first line as the beginning of the command line to run this script.  The
1608only mangling done to the first line is extraction of arguments (currently
1609up to 3), and ignoring of the path-part of the "interpreter" name if it can't
1610be found using the full path.
1611
1612E.g., C<system 'foo', 'bar', 'baz'> may lead Perl to finding
1613F<C:/emx/bin/foo.cmd> with the first line being
1614
1615 extproc /bin/bash    -x   -c
1616
1617If F</bin/bash.exe> is not found, then Perl looks for an executable F<bash.exe> on
1618C<PATH>.  If found in F<C:/emx.add/bin/bash.exe>, then the above system() is
1619translated to
1620
1621  system qw(C:/emx.add/bin/bash.exe -x -c C:/emx/bin/foo.cmd bar baz)
1622
1623One additional translation is performed: instead of F</bin/sh> Perl uses
1624the hardwired-or-customized shell (see L</"C<PERL_SH_DIR>">).
1625
1626The above search for "interpreter" is recursive: if F<bash> executable is not
1627found, but F<bash.btm> is found, Perl will investigate its first line etc.
1628The only hardwired limit on the recursion depth is implicit: there is a limit
16294 on the number of additional arguments inserted before the actual arguments
1630given to system().  In particular, if no additional arguments are specified
1631on the "magic" first lines, then the limit on the depth is 4.
1632
1633If Perl finds that the found executable is of PM type when the
1634current session is not, it will start the new process in a separate session of
1635necessary type.  Call via C<OS2::Process> to disable this magic.
1636
1637B<WARNING>.  Due to the described logic, you need to explicitly
1638specify F<.com> extension if needed.  Moreover, if the executable
1639F<perl5.6.1> is requested, Perl will not look for F<perl5.6.1.exe>.
1640[This may change in the future.]
1641
1642=head2 C<extproc> on the first line
1643
1644If the first chars of a Perl script are C<"extproc ">, this line is treated
1645as C<#!>-line, thus all the switches on this line are processed (twice
1646if script was started via cmd.exe).  See L<perlrun/DESCRIPTION>.
1647
1648=head2 Additional modules:
1649
1650L<OS2::Process>, L<OS2::DLL>, L<OS2::REXX>, L<OS2::PrfDB>, L<OS2::ExtAttr>. These
1651modules provide access to additional numeric argument for C<system>
1652and to the information about the running process,
1653to DLLs having functions with REXX signature and to the REXX runtime, to
1654OS/2 databases in the F<.INI> format, and to Extended Attributes.
1655
1656Two additional extensions by Andreas Kaiser, C<OS2::UPM>, and
1657C<OS2::FTP>, are included into C<ILYAZ> directory, mirrored on CPAN.
1658Other OS/2-related extensions are available too.
1659
1660=head2 Prebuilt methods:
1661
1662=over 4
1663
1664=item C<File::Copy::syscopy>
1665
1666used by C<File::Copy::copy>, see L<File::Copy>.
1667
1668=item C<DynaLoader::mod2fname>
1669
1670used by C<DynaLoader> for DLL name mangling.
1671
1672=item  C<Cwd::current_drive()>
1673
1674Self explanatory.
1675
1676=item  C<Cwd::sys_chdir(name)>
1677
1678leaves drive as it is.
1679
1680=item  C<Cwd::change_drive(name)>
1681
1682changes the "current" drive.
1683
1684=item  C<Cwd::sys_is_absolute(name)>
1685
1686means has drive letter and is_rooted.
1687
1688=item  C<Cwd::sys_is_rooted(name)>
1689
1690means has leading C<[/\\]> (maybe after a drive-letter:).
1691
1692=item  C<Cwd::sys_is_relative(name)>
1693
1694means changes with current dir.
1695
1696=item  C<Cwd::sys_cwd(name)>
1697
1698Interface to cwd from EMX. Used by C<Cwd::cwd>.
1699
1700=item  C<Cwd::sys_abspath(name, dir)>
1701
1702Really really odious function to implement. Returns absolute name of
1703file which would have C<name> if CWD were C<dir>.  C<Dir> defaults to the
1704current dir.
1705
1706=item  C<Cwd::extLibpath([type])>
1707
1708Get current value of extended library search path. If C<type> is
1709present and positive, works with C<END_LIBPATH>, if negative, works
1710with C<LIBPATHSTRICT>, otherwise with C<BEGIN_LIBPATH>.
1711
1712=item  C<Cwd::extLibpath_set( path [, type ] )>
1713
1714Set current value of extended library search path. If C<type> is
1715present and positive, works with <END_LIBPATH>, if negative, works
1716with C<LIBPATHSTRICT>, otherwise with C<BEGIN_LIBPATH>.
1717
1718=item C<OS2::Error(do_harderror,do_exception)>
1719
1720Returns	C<undef> if it was not called yet, otherwise bit 1 is
1721set if on the previous call do_harderror was enabled, bit
17222 is set if on previous call do_exception was enabled.
1723
1724This function enables/disables error popups associated with
1725hardware errors (Disk not ready etc.) and software exceptions.
1726
1727I know of no way to find out the state of popups I<before> the first call
1728to this function.
1729
1730=item C<OS2::Errors2Drive(drive)>
1731
1732Returns C<undef> if it was not called yet, otherwise return false if errors
1733were not requested to be written to a hard drive, or the drive letter if
1734this was requested.
1735
1736This function may redirect error popups associated with hardware errors
1737(Disk not ready etc.) and software exceptions to the file POPUPLOG.OS2 at
1738the root directory of the specified drive.  Overrides OS2::Error() specified
1739by individual programs.  Given argument undef will disable redirection.
1740
1741Has global effect, persists after the application exits.
1742
1743I know of no way to find out the state of redirection of popups to the disk
1744I<before> the first call to this function.
1745
1746=item OS2::SysInfo()
1747
1748Returns a hash with system information. The keys of the hash are
1749
1750	MAX_PATH_LENGTH, MAX_TEXT_SESSIONS, MAX_PM_SESSIONS,
1751	MAX_VDM_SESSIONS, BOOT_DRIVE, DYN_PRI_VARIATION,
1752	MAX_WAIT, MIN_SLICE, MAX_SLICE, PAGE_SIZE,
1753	VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION,
1754	MS_COUNT, TIME_LOW, TIME_HIGH, TOTPHYSMEM, TOTRESMEM,
1755	TOTAVAILMEM, MAXPRMEM, MAXSHMEM, TIMER_INTERVAL,
1756	MAX_COMP_LENGTH, FOREGROUND_FS_SESSION,
1757	FOREGROUND_PROCESS
1758
1759=item OS2::BootDrive()
1760
1761Returns a letter without colon.
1762
1763=item C<OS2::MorphPM(serve)>, C<OS2::UnMorphPM(serve)>
1764
1765Transforms the current application into a PM application and back.
1766The argument true means that a real message loop is going to be served.
1767OS2::MorphPM() returns the PM message queue handle as an integer.
1768
1769See L</"Centralized management of resources"> for additional details.
1770
1771=item C<OS2::Serve_Messages(force)>
1772
1773Fake on-demand retrieval of outstanding PM messages.  If C<force> is false,
1774will not dispatch messages if a real message loop is known to
1775be present.  Returns number of messages retrieved.
1776
1777Dies with "QUITing..." if WM_QUIT message is obtained.
1778
1779=item C<OS2::Process_Messages(force [, cnt])>
1780
1781Retrieval of PM messages until window creation/destruction.
1782If C<force> is false, will not dispatch messages if a real message loop
1783is known to be present.
1784
1785Returns change in number of windows.  If C<cnt> is given,
1786it is incremented by the number of messages retrieved.
1787
1788Dies with "QUITing..." if WM_QUIT message is obtained.
1789
1790=item C<OS2::_control87(new,mask)>
1791
1792the same as L<_control87(3)> of EMX.  Takes integers as arguments, returns
1793the previous coprocessor control word as an integer.  Only bits in C<new> which
1794are present in C<mask> are changed in the control word.
1795
1796=item OS2::get_control87()
1797
1798gets the coprocessor control word as an integer.
1799
1800=item C<OS2::set_control87_em(new=MCW_EM,mask=MCW_EM)>
1801
1802The variant of OS2::_control87() with default values good for
1803handling exception mask: if no C<mask>, uses exception mask part of C<new>
1804only.  If no C<new>, disables all the floating point exceptions.
1805
1806See L</"Misfeatures"> for details.
1807
1808=item C<OS2::DLLname([how [, \&xsub]])>
1809
1810Gives the information about the Perl DLL or the DLL containing the C
1811function bound to by C<&xsub>.  The meaning of C<how> is: default (2):
1812full name; 0: handle; 1: module name.
1813
1814=back
1815
1816(Note that some of these may be moved to different libraries -
1817eventually).
1818
1819
1820=head2 Prebuilt variables:
1821
1822=over 4
1823
1824=item $OS2::emx_rev
1825
1826numeric value is the same as _emx_rev of EMX, a string value the same
1827as _emx_vprt (similar to C<0.9c>).
1828
1829=item $OS2::emx_env
1830
1831same as _emx_env of EMX, a number similar to 0x8001.
1832
1833=item $OS2::os_ver
1834
1835a number C<OS_MAJOR + 0.001 * OS_MINOR>.
1836
1837=item $OS2::is_aout
1838
1839true if the Perl library was compiled in AOUT format.
1840
1841=item $OS2::can_fork
1842
1843true if the current executable is an AOUT EMX executable, so Perl can
1844fork.  Do not use this, use the portable check for
1845$Config::Config{dfork}.
1846
1847=item $OS2::nsyserror
1848
1849This variable (default is 1) controls whether to enforce the contents
1850of $^E to start with C<SYS0003>-like id.  If set to 0, then the string
1851value of $^E is what is available from the OS/2 message file.  (Some
1852messages in this file have an C<SYS0003>-like id prepended, some not.)
1853
1854=back
1855
1856=head2 Misfeatures
1857
1858=over 4
1859
1860=item *
1861
1862Since L<flock(3)> is present in EMX, but is not functional, it is
1863emulated by perl.  To disable the emulations, set environment variable
1864C<USE_PERL_FLOCK=0>.
1865
1866=item *
1867
1868Here is the list of things which may be "broken" on
1869EMX (from EMX docs):
1870
1871=over 4
1872
1873=item *
1874
1875The functions L<recvmsg(3)>, L<sendmsg(3)>, and L<socketpair(3)> are not
1876implemented.
1877
1878=item *
1879
1880L<sock_init(3)> is not required and not implemented.
1881
1882=item *
1883
1884L<flock(3)> is not yet implemented (dummy function).  (Perl has a workaround.)
1885
1886=item *
1887
1888L<kill(3)>:  Special treatment of PID=0, PID=1 and PID=-1 is not implemented.
1889
1890=item *
1891
1892L<waitpid(3)>:
1893
1894      WUNTRACED
1895	      Not implemented.
1896      waitpid() is not implemented for negative values of PID.
1897
1898=back
1899
1900Note that C<kill -9> does not work with the current version of EMX.
1901
1902=item *
1903
1904See L</"Text-mode filehandles">.
1905
1906=item *
1907
1908Unix-domain sockets on OS/2 live in a pseudo-file-system C</sockets/...>.
1909To avoid a failure to create a socket with a name of a different form,
1910C<"/socket/"> is prepended to the socket name (unless it starts with this
1911already).
1912
1913This may lead to problems later in case the socket is accessed via the
1914"usual" file-system calls using the "initial" name.
1915
1916=item *
1917
1918Apparently, IBM used a compiler (for some period of time around '95?) which
1919changes FP mask right and left.  This is not I<that> bad for IBM's
1920programs, but the same compiler was used for DLLs which are used with
1921general-purpose applications.  When these DLLs are used, the state of
1922floating-point flags in the application is not predictable.
1923
1924What is much worse, some DLLs change the floating point flags when in
1925_DLLInitTerm() (e.g., F<TCP32IP>).  This means that even if you do not I<call>
1926any function in the DLL, just the act of loading this DLL will reset your
1927flags.  What is worse, the same compiler was used to compile some HOOK DLLs.
1928Given that HOOK dlls are executed in the context of I<all> the applications
1929in the system, this means a complete unpredictability of floating point
1930flags on systems using such HOOK DLLs.  E.g., F<GAMESRVR.DLL> of B<DIVE>
1931origin changes the floating point flags on each write to the TTY of a VIO
1932(windowed text-mode) applications.
1933
1934Some other (not completely debugged) situations when FP flags change include
1935some video drivers (?), and some operations related to creation of the windows.
1936People who code B<OpenGL> may have more experience on this.
1937
1938Perl is generally used in the situation when all the floating-point
1939exceptions are ignored, as is the default under EMX.  If they are not ignored,
1940some benign Perl programs would get a C<SIGFPE> and would die a horrible death.
1941
1942To circumvent this, Perl uses two hacks.  They help against I<one> type of
1943damage only: FP flags changed when loading a DLL.
1944
1945One of the hacks is to disable floating point exceptions on Perl startup (as
1946is the default with EMX).  This helps only with compile-time-linked DLLs
1947changing the flags before main() had a chance to be called.
1948
1949The other hack is to restore FP flags after a call to dlopen().  This helps
1950against similar damage done by DLLs _DLLInitTerm() at runtime.  Currently
1951no way to switch these hacks off is provided.
1952
1953=back
1954
1955=head2 Modifications
1956
1957Perl modifies some standard C library calls in the following ways:
1958
1959=over 9
1960
1961=item C<popen>
1962
1963C<my_popen> uses F<sh.exe> if shell is required, cf. L</"C<PERL_SH_DIR>">.
1964
1965=item C<tmpnam>
1966
1967is created using C<TMP> or C<TEMP> environment variable, via
1968C<tempnam>.
1969
1970=item C<tmpfile>
1971
1972If the current directory is not writable, file is created using modified
1973C<tmpnam>, so there may be a race condition.
1974
1975=item C<ctermid>
1976
1977a dummy implementation.
1978
1979=item C<stat>
1980
1981C<os2_stat> special-cases F</dev/tty> and F</dev/con>.
1982
1983=item C<mkdir>, C<rmdir>
1984
1985these EMX functions do not work if the path contains a trailing C</>.
1986Perl contains a workaround for this.
1987
1988=item C<flock>
1989
1990Since L<flock(3)> is present in EMX, but is not functional, it is
1991emulated by perl.  To disable the emulations, set environment variable
1992C<USE_PERL_FLOCK=0>.
1993
1994=back
1995
1996=head2 Identifying DLLs
1997
1998All the DLLs built with the current versions of Perl have ID strings
1999identifying the name of the extension, its version, and the version
2000of Perl required for this DLL.  Run C<bldlevel DLL-name> to find this
2001info.
2002
2003=head2 Centralized management of resources
2004
2005Since to call certain OS/2 API one needs to have a correctly initialized
2006C<Win> subsystem, OS/2-specific extensions may require getting C<HAB>s and
2007C<HMQ>s.  If an extension would do it on its own, another extension could
2008fail to initialize.
2009
2010Perl provides a centralized management of these resources:
2011
2012=over
2013
2014=item C<HAB>
2015
2016To get the HAB, the extension should call C<hab = perl_hab_GET()> in C.  After
2017this call is performed, C<hab> may be accessed as C<Perl_hab>.  There is
2018no need to release the HAB after it is used.
2019
2020If by some reasons F<perl.h> cannot be included, use
2021
2022  extern int Perl_hab_GET(void);
2023
2024instead.
2025
2026=item C<HMQ>
2027
2028There are two cases:
2029
2030=over
2031
2032=item *
2033
2034the extension needs an C<HMQ> only because some API will not work otherwise.
2035Use C<serve = 0> below.
2036
2037=item *
2038
2039the extension needs an C<HMQ> since it wants to engage in a PM event loop.
2040Use C<serve = 1> below.
2041
2042=back
2043
2044To get an C<HMQ>, the extension should call C<hmq = perl_hmq_GET(serve)> in C.
2045After this call is performed, C<hmq> may be accessed as C<Perl_hmq>.
2046
2047To signal to Perl that HMQ is not needed any more, call
2048C<perl_hmq_UNSET(serve)>.  Perl process will automatically morph/unmorph itself
2049into/from a PM process if HMQ is needed/not-needed.  Perl will automatically
2050enable/disable C<WM_QUIT> message during shutdown if the message queue is
2051served/not-served.
2052
2053B<NOTE>.  If during a shutdown there is a message queue which did not disable
2054WM_QUIT, and which did not process the received WM_QUIT message, the
2055shutdown will be automatically cancelled.  Do not call C<perl_hmq_GET(1)>
2056unless you are going to process messages on an orderly basis.
2057
2058=item Treating errors reported by OS/2 API
2059
2060There are two principal conventions (it is useful to call them C<Dos*>
2061and C<Win*> - though this part of the function signature is not always
2062determined by the name of the API) of reporting the error conditions
2063of OS/2 API.  Most of C<Dos*> APIs report the error code as the result
2064of the call (so 0 means success, and there are many types of errors).
2065Most of C<Win*> API report success/fail via the result being
2066C<TRUE>/C<FALSE>; to find the reason for the failure one should call
2067WinGetLastError() API.
2068
2069Some C<Win*> entry points also overload a "meaningful" return value
2070with the error indicator; having a 0 return value indicates an error.
2071Yet some other C<Win*> entry points overload things even more, and 0
2072return value may mean a successful call returning a valid value 0, as
2073well as an error condition; in the case of a 0 return value one should
2074call WinGetLastError() API to distinguish a successful call from a
2075failing one.
2076
2077By convention, all the calls to OS/2 API should indicate their
2078failures by resetting $^E.  All the Perl-accessible functions which
2079call OS/2 API may be broken into two classes: some die()s when an API
2080error is encountered, the other report the error via a false return
2081value (of course, this does not concern Perl-accessible functions
2082which I<expect> a failure of the OS/2 API call, having some workarounds
2083coded).
2084
2085Obviously, in the situation of the last type of the signature of an OS/2
2086API, it is must more convenient for the users if the failure is
2087indicated by die()ing: one does not need to check $^E to know that
2088something went wrong.  If, however, this solution is not desirable by
2089some reason, the code in question should reset $^E to 0 before making
2090this OS/2 API call, so that the caller of this Perl-accessible
2091function has a chance to distinguish a success-but-0-return value from
2092a failure.  (One may return undef as an alternative way of reporting
2093an error.)
2094
2095The macros to simplify this type of error propagation are
2096
2097=over
2098
2099=item C<CheckOSError(expr)>
2100
2101Returns true on error, sets $^E.  Expects expr() be a call of
2102C<Dos*>-style API.
2103
2104=item C<CheckWinError(expr)>
2105
2106Returns true on error, sets $^E.  Expects expr() be a call of
2107C<Win*>-style API.
2108
2109=item C<SaveWinError(expr)>
2110
2111Returns C<expr>, sets $^E from WinGetLastError() if C<expr> is false.
2112
2113=item C<SaveCroakWinError(expr,die,name1,name2)>
2114
2115Returns C<expr>, sets $^E from WinGetLastError() if C<expr> is false,
2116and die()s if C<die> and $^E are true.  The message to die is the
2117concatenated strings C<name1> and C<name2>, separated by C<": "> from
2118the contents of $^E.
2119
2120=item C<WinError_2_Perl_rc>
2121
2122Sets C<Perl_rc> to the return value of WinGetLastError().
2123
2124=item C<FillWinError>
2125
2126Sets C<Perl_rc> to the return value of WinGetLastError(), and sets $^E
2127to the corresponding value.
2128
2129=item C<FillOSError(rc)>
2130
2131Sets C<Perl_rc> to C<rc>, and sets $^E to the corresponding value.
2132
2133=back
2134
2135=item Loading DLLs and ordinals in DLLs
2136
2137Some DLLs are only present in some versions of OS/2, or in some
2138configurations of OS/2.  Some exported entry points are present only
2139in DLLs shipped with some versions of OS/2.  If these DLLs and entry
2140points were linked directly for a Perl executable/DLL or from a Perl
2141extensions, this binary would work only with the specified
2142versions/setups.  Even if these entry points were not needed, the
2143I<load> of the executable (or DLL) would fail.
2144
2145For example, many newer useful APIs are not present in OS/2 v2; many
2146PM-related APIs require DLLs not available on floppy-boot setup.
2147
2148To make these calls fail I<only when the calls are executed>, one
2149should call these API via a dynamic linking API.  There is a subsystem
2150in Perl to simplify such type of calls.  A large number of entry
2151points available for such linking is provided (see C<entries_ordinals>
2152- and also C<PMWIN_entries> - in F<os2ish.h>).  These ordinals can be
2153accessed via the APIs:
2154
2155 CallORD(), DeclFuncByORD(), DeclVoidFuncByORD(),
2156 DeclOSFuncByORD(), DeclWinFuncByORD(), AssignFuncPByORD(),
2157 DeclWinFuncByORD_CACHE(), DeclWinFuncByORD_CACHE_survive(),
2158 DeclWinFuncByORD_CACHE_resetError_survive(),
2159 DeclWinFunc_CACHE(), DeclWinFunc_CACHE_resetError(),
2160 DeclWinFunc_CACHE_survive(), DeclWinFunc_CACHE_resetError_survive()
2161
2162See the header files and the C code in the supplied OS/2-related
2163modules for the details on usage of these functions.
2164
2165Some of these functions also combine dynaloading semantic with the
2166error-propagation semantic discussed above.
2167
2168=back
2169
2170=head1 Perl flavors
2171
2172Because of idiosyncrasies of OS/2 one cannot have all the eggs in the
2173same basket (though EMX environment tries hard to overcome this
2174limitations, so the situation may somehow improve). There are 4
2175executables for Perl provided by the distribution:
2176
2177=head2 F<perl.exe>
2178
2179The main workhorse. This is a chimera executable: it is compiled as an
2180C<a.out>-style executable, but is linked with C<omf>-style dynamic
2181library F<perl.dll>, and with dynamic CRT DLL. This executable is a
2182VIO application.
2183
2184It can load perl dynamic extensions, and it can fork().
2185
2186B<Note.> Keep in mind that fork() is needed to open a pipe to yourself.
2187
2188=head2 F<perl_.exe>
2189
2190This is a statically linked C<a.out>-style executable. It cannot
2191load dynamic Perl extensions. The executable supplied in binary
2192distributions has a lot of extensions prebuilt, thus the above restriction is
2193important only if you use custom-built extensions. This executable is a VIO
2194application.
2195
2196I<This is the only executable with does not require OS/2.> The
2197friends locked into C<M$> world would appreciate the fact that this
2198executable runs under DOS, Win0.3*, Win0.95 and WinNT with an
2199appropriate extender. See L</"Other OSes">.
2200
2201=head2 F<perl__.exe>
2202
2203This is the same executable as F<perl___.exe>, but it is a PM
2204application.
2205
2206B<Note.> Usually (unless explicitly redirected during the startup)
2207STDIN, STDERR, and STDOUT of a PM
2208application are redirected to F<nul>. However, it is possible to I<see>
2209them if you start C<perl__.exe> from a PM program which emulates a
2210console window, like I<Shell mode> of Emacs or EPM. Thus it I<is
2211possible> to use Perl debugger (see L<perldebug>) to debug your PM
2212application (but beware of the message loop lockups - this will not
2213work if you have a message queue to serve, unless you hook the serving
2214into the getc() function of the debugger).
2215
2216Another way to see the output of a PM program is to run it as
2217
2218  pm_prog args 2>&1 | cat -
2219
2220with a shell I<different> from F<cmd.exe>, so that it does not create
2221a link between a VIO session and the session of C<pm_porg>.  (Such a link
2222closes the VIO window.)  E.g., this works with F<sh.exe> - or with Perl!
2223
2224  open P, 'pm_prog args 2>&1 |' or die;
2225  print while <P>;
2226
2227The flavor F<perl__.exe> is required if you want to start your program without
2228a VIO window present, but not C<detach>ed (run C<help detach> for more info).
2229Very useful for extensions which use PM, like C<Perl/Tk> or C<OpenGL>.
2230
2231Note also that the differences between PM and VIO executables are only
2232in the I<default> behaviour.  One can start I<any> executable in
2233I<any> kind of session by using the arguments C</fs>, C</pm> or
2234C</win> switches of the command C<start> (of F<CMD.EXE> or a similar
2235shell).  Alternatively, one can use the numeric first argument of the
2236C<system> Perl function (see L<OS2::Process>).
2237
2238=head2 F<perl___.exe>
2239
2240This is an C<omf>-style executable which is dynamically linked to
2241F<perl.dll> and CRT DLL. I know no advantages of this executable
2242over C<perl.exe>, but it cannot fork() at all. Well, one advantage is
2243that the build process is not so convoluted as with C<perl.exe>.
2244
2245It is a VIO application.
2246
2247=head2 Why strange names?
2248
2249Since Perl processes the C<#!>-line (cf.
2250L<perlrun/DESCRIPTION>, L<perlrun/Command Switches>,
2251L<perldiag/"No Perl script found in input">), it should know when a
2252program I<is a Perl>. There is some naming convention which allows
2253Perl to distinguish correct lines from wrong ones. The above names are
2254almost the only names allowed by this convention which do not contain
2255digits (which have absolutely different semantics).
2256
2257=head2 Why dynamic linking?
2258
2259Well, having several executables dynamically linked to the same huge
2260library has its advantages, but this would not substantiate the
2261additional work to make it compile. The reason is the complicated-to-developers
2262but very quick and convenient-to-users "hard" dynamic linking used by OS/2.
2263
2264There are two distinctive features of the dyna-linking model of OS/2:
2265first, all the references to external functions are resolved at the compile time;
2266second, there is no runtime fixup of the DLLs after they are loaded into memory.
2267The first feature is an enormous advantage over other models: it avoids
2268conflicts when several DLLs used by an application export entries with
2269the same name.  In such cases "other" models of dyna-linking just choose
2270between these two entry points using some random criterion - with predictable
2271disasters as results.  But it is the second feature which requires the build
2272of F<perl.dll>.
2273
2274The address tables of DLLs are patched only once, when they are
2275loaded. The addresses of the entry points into DLLs are guaranteed to be
2276the same for all the programs which use the same DLL.  This removes the
2277runtime fixup - once DLL is loaded, its code is read-only.
2278
2279While this allows some (significant?) performance advantages, this makes life
2280much harder for developers, since the above scheme makes it impossible
2281for a DLL to be "linked" to a symbol in the F<.EXE> file.  Indeed, this
2282would need a DLL to have different relocations tables for the
2283(different) executables which use this DLL.
2284
2285However, a dynamically loaded Perl extension is forced to use some symbols
2286from the perl
2287executable, e.g., to know how to find the arguments to the functions:
2288the arguments live on the perl
2289internal evaluation stack. The solution is to put the main code of
2290the interpreter into a DLL, and make the F<.EXE> file which just loads
2291this DLL into memory and supplies command-arguments.  The extension DLL
2292cannot link to symbols in F<.EXE>, but it has no problem linking
2293to symbols in the F<.DLL>.
2294
2295This I<greatly> increases the load time for the application (as well as
2296complexity of the compilation). Since interpreter is in a DLL,
2297the C RTL is basically forced to reside in a DLL as well (otherwise
2298extensions would not be able to use CRT).  There are some advantages if
2299you use different flavors of perl, such as running F<perl.exe> and
2300F<perl__.exe> simultaneously: they share the memory of F<perl.dll>.
2301
2302B<NOTE>.  There is one additional effect which makes DLLs more wasteful:
2303DLLs are loaded in the shared memory region, which is a scarse resource
2304given the 512M barrier of the "standard" OS/2 virtual memory.  The code of
2305F<.EXE> files is also shared by all the processes which use the particular
2306F<.EXE>, but they are "shared in the private address space of the process";
2307this is possible because the address at which different sections
2308of the F<.EXE> file are loaded is decided at compile-time, thus all the
2309processes have these sections loaded at same addresses, and no fixup
2310of internal links inside the F<.EXE> is needed.
2311
2312Since DLLs may be loaded at run time, to have the same mechanism for DLLs
2313one needs to have the address range of I<any of the loaded> DLLs in the
2314system to be available I<in all the processes> which did not load a particular
2315DLL yet.  This is why the DLLs are mapped to the shared memory region.
2316
2317=head2 Why chimera build?
2318
2319Current EMX environment does not allow DLLs compiled using Unixish
2320C<a.out> format to export symbols for data (or at least some types of
2321data). This forces C<omf>-style compile of F<perl.dll>.
2322
2323Current EMX environment does not allow F<.EXE> files compiled in
2324C<omf> format to fork(). fork() is needed for exactly three Perl
2325operations:
2326
2327=over 4
2328
2329=item *
2330
2331explicit fork() in the script,
2332
2333=item *
2334
2335C<open FH, "|-">
2336
2337=item *
2338
2339C<open FH, "-|">, in other words, opening pipes to itself.
2340
2341=back
2342
2343While these operations are not questions of life and death, they are
2344needed for a lot of
2345useful scripts. This forces C<a.out>-style compile of
2346F<perl.exe>.
2347
2348
2349=head1 ENVIRONMENT
2350
2351Here we list environment variables with are either OS/2- and DOS- and
2352Win*-specific, or are more important under OS/2 than under other OSes.
2353
2354=head2 C<PERLLIB_PREFIX>
2355
2356Specific for EMX port. Should have the form
2357
2358  path1;path2
2359
2360or
2361
2362  path1 path2
2363
2364If the beginning of some prebuilt path matches F<path1>, it is
2365substituted with F<path2>.
2366
2367Should be used if the perl library is moved from the default
2368location in preference to C<PERL(5)LIB>, since this would not leave wrong
2369entries in @INC.  For example, if the compiled version of perl looks for @INC
2370in F<f:/perllib/lib>, and you want to install the library in
2371F<h:/opt/gnu>, do
2372
2373  set PERLLIB_PREFIX=f:/perllib/lib;h:/opt/gnu
2374
2375This will cause Perl with the prebuilt @INC of
2376
2377  f:/perllib/lib/5.00553/os2
2378  f:/perllib/lib/5.00553
2379  f:/perllib/lib/site_perl/5.00553/os2
2380  f:/perllib/lib/site_perl/5.00553
2381  .
2382
2383to use the following @INC:
2384
2385  h:/opt/gnu/5.00553/os2
2386  h:/opt/gnu/5.00553
2387  h:/opt/gnu/site_perl/5.00553/os2
2388  h:/opt/gnu/site_perl/5.00553
2389  .
2390
2391=head2 C<PERL_BADLANG>
2392
2393If 0, perl ignores setlocale() failing. May be useful with some
2394strange I<locale>s.
2395
2396=head2 C<PERL_BADFREE>
2397
2398If 0, perl would not warn of in case of unwarranted free(). With older
2399perls this might be
2400useful in conjunction with the module DB_File, which was buggy when
2401dynamically linked and OMF-built.
2402
2403Should not be set with newer Perls, since this may hide some I<real> problems.
2404
2405=head2 C<PERL_SH_DIR>
2406
2407Specific for EMX port. Gives the directory part of the location for
2408F<sh.exe>.
2409
2410=head2 C<USE_PERL_FLOCK>
2411
2412Specific for EMX port. Since L<flock(3)> is present in EMX, but is not
2413functional, it is emulated by perl.  To disable the emulations, set
2414environment variable C<USE_PERL_FLOCK=0>.
2415
2416=head2 C<TMP> or C<TEMP>
2417
2418Specific for EMX port. Used as storage place for temporary files.
2419
2420=head1 Evolution
2421
2422Here we list major changes which could make you by surprise.
2423
2424=head2 Text-mode filehandles
2425
2426Starting from version 5.8, Perl uses a builtin translation layer for
2427text-mode files.  This replaces the efficient well-tested EMX layer by
2428some code which should be best characterized as a "quick hack".
2429
2430In addition to possible bugs and an inability to follow changes to the
2431translation policy with off/on switches of TERMIO translation, this
2432introduces a serious incompatible change: before sysread() on
2433text-mode filehandles would go through the translation layer, now it
2434would not.
2435
2436=head2 Priorities
2437
2438C<setpriority> and C<getpriority> are not compatible with earlier
2439ports by Andreas Kaiser. See L</setpriority, getpriority>.
2440
2441=head2 DLL name mangling: pre 5.6.2
2442
2443With the release 5.003_01 the dynamically loadable libraries
2444should be rebuilt when a different version of Perl is compiled. In particular,
2445DLLs (including F<perl.dll>) are now created with the names
2446which contain a checksum, thus allowing workaround for OS/2 scheme of
2447caching DLLs.
2448
2449It may be possible to code a simple workaround which would
2450
2451=over
2452
2453=item *
2454
2455find the old DLLs looking through the old @INC;
2456
2457=item *
2458
2459mangle the names according to the scheme of new perl and copy the DLLs to
2460these names;
2461
2462=item *
2463
2464edit the internal C<LX> tables of DLL to reflect the change of the name
2465(probably not needed for Perl extension DLLs, since the internally coded names
2466are not used for "specific" DLLs, they used only for "global" DLLs).
2467
2468=item *
2469
2470edit the internal C<IMPORT> tables and change the name of the "old"
2471F<perl????.dll> to the "new" F<perl????.dll>.
2472
2473=back
2474
2475=head2 DLL name mangling: 5.6.2 and beyond
2476
2477In fact mangling of I<extension> DLLs was done due to misunderstanding
2478of the OS/2 dynaloading model.  OS/2 (effectively) maintains two
2479different tables of loaded DLL:
2480
2481=over
2482
2483=item Global DLLs
2484
2485those loaded by the base name from C<LIBPATH>; including those
2486associated at link time;
2487
2488=item specific DLLs
2489
2490loaded by the full name.
2491
2492=back
2493
2494When resolving a request for a global DLL, the table of already-loaded
2495specific DLLs is (effectively) ignored; moreover, specific DLLs are
2496I<always> loaded from the prescribed path.
2497
2498There is/was a minor twist which makes this scheme fragile: what to do
2499with DLLs loaded from
2500
2501=over
2502
2503=item C<BEGINLIBPATH> and C<ENDLIBPATH>
2504
2505(which depend on the process)
2506
2507=item F<.> from C<LIBPATH>
2508
2509which I<effectively> depends on the process (although C<LIBPATH> is the
2510same for all the processes).
2511
2512=back
2513
2514Unless C<LIBPATHSTRICT> is set to C<T> (and the kernel is after
25152000/09/01), such DLLs are considered to be global.  When loading a
2516global DLL it is first looked in the table of already-loaded global
2517DLLs.  Because of this the fact that one executable loaded a DLL from
2518C<BEGINLIBPATH> and C<ENDLIBPATH>, or F<.> from C<LIBPATH> may affect
2519I<which> DLL is loaded when I<another> executable requests a DLL with
2520the same name.  I<This> is the reason for version-specific mangling of
2521the DLL name for perl DLL.
2522
2523Since the Perl extension DLLs are always loaded with the full path,
2524there is no need to mangle their names in a version-specific ways:
2525their directory already reflects the corresponding version of perl,
2526and @INC takes into account binary compatibility with older version.
2527Starting from C<5.6.2> the name mangling scheme is fixed to be the
2528same as for Perl 5.005_53 (same as in a popular binary release).  Thus
2529new Perls will be able to I<resolve the names> of old extension DLLs
2530if @INC allows finding their directories.
2531
2532However, this still does not guarantee that these DLL may be loaded.
2533The reason is the mangling of the name of the I<Perl DLL>.  And since
2534the extension DLLs link with the Perl DLL, extension DLLs for older
2535versions would load an older Perl DLL, and would most probably
2536segfault (since the data in this DLL is not properly initialized).
2537
2538There is a partial workaround (which can be made complete with newer
2539OS/2 kernels): create a forwarder DLL with the same name as the DLL of
2540the older version of Perl, which forwards the entry points to the
2541newer Perl's DLL.  Make this DLL accessible on (say) the C<BEGINLIBPATH> of
2542the new Perl executable.  When the new executable accesses old Perl's
2543extension DLLs, they would request the old Perl's DLL by name, get the
2544forwarder instead, so effectively will link with the currently running
2545(new) Perl DLL.
2546
2547This may break in two ways:
2548
2549=over
2550
2551=item *
2552
2553Old perl executable is started when a new executable is running has
2554loaded an extension compiled for the old executable (ouph!).  In this
2555case the old executable will get a forwarder DLL instead of the old
2556perl DLL, so would link with the new perl DLL.  While not directly
2557fatal, it will behave the same as new executable.  This beats the whole
2558purpose of explicitly starting an old executable.
2559
2560=item *
2561
2562A new executable loads an extension compiled for the old executable
2563when an old perl executable is running.  In this case the extension
2564will not pick up the forwarder - with fatal results.
2565
2566=back
2567
2568With support for C<LIBPATHSTRICT> this may be circumvented - unless
2569one of DLLs is started from F<.> from C<LIBPATH> (I do not know
2570whether C<LIBPATHSTRICT> affects this case).
2571
2572B<REMARK>.  Unless newer kernels allow F<.> in C<BEGINLIBPATH> (older
2573do not), this mess cannot be completely cleaned.  (It turns out that
2574as of the beginning of 2002, F<.> is not allowed, but F<.\.> is - and
2575it has the same effect.)
2576
2577
2578B<REMARK>.  C<LIBPATHSTRICT>, C<BEGINLIBPATH> and C<ENDLIBPATH> are
2579not environment variables, although F<cmd.exe> emulates them on C<SET
2580...> lines.  From Perl they may be accessed by
2581L<Cwd::extLibpath|/Cwd::extLibpath([type])> and
2582L<Cwd::extLibpath_set|/Cwd::extLibpath_set( path [, type ] )>.
2583
2584=head2 DLL forwarder generation
2585
2586Assume that the old DLL is named F<perlE0AC.dll> (as is one for
25875.005_53), and the new version is 5.6.1.  Create a file
2588F<perl5shim.def-leader> with
2589
2590  LIBRARY 'perlE0AC' INITINSTANCE TERMINSTANCE
2591  DESCRIPTION '@#perl5-porters@perl.org:5.006001#@ Perl module for 5.00553 -> Perl 5.6.1 forwarder'
2592  CODE LOADONCALL
2593  DATA LOADONCALL NONSHARED MULTIPLE
2594  EXPORTS
2595
2596modifying the versions/names as needed.  Run
2597
2598 perl -wnle "next if 0../EXPORTS/; print qq(  \"$1\")
2599                                          if /\"(\w+)\"/" perl5.def >lst
2600
2601in the Perl build directory (to make the DLL smaller replace perl5.def
2602with the definition file for the older version of Perl if present).
2603
2604 cat perl5shim.def-leader lst >perl5shim.def
2605 gcc -Zomf -Zdll -o perlE0AC.dll perl5shim.def -s -llibperl
2606
2607(ignore multiple C<warning L4085>).
2608
2609=head2 Threading
2610
2611As of release 5.003_01 perl is linked to multithreaded C RTL
2612DLL.  If perl itself is not compiled multithread-enabled, so will not be perl's
2613malloc(). However, extensions may use multiple thread on their own
2614risk.
2615
2616This was needed to compile C<Perl/Tk> for XFree86-OS/2 out-of-the-box, and
2617link with DLLs for other useful libraries, which typically are compiled
2618with C<-Zmt -Zcrtdll>.
2619
2620=head2 Calls to external programs
2621
2622Due to a popular demand the perl external program calling has been
2623changed wrt Andreas Kaiser's port.  I<If> perl needs to call an
2624external program I<via shell>, the F<f:/bin/sh.exe> will be called, or
2625whatever is the override, see L</"C<PERL_SH_DIR>">.
2626
2627Thus means that you need to get some copy of a F<sh.exe> as well (I
2628use one from pdksh). The path F<F:/bin> above is set up automatically during
2629the build to a correct value on the builder machine, but is
2630overridable at runtime,
2631
2632B<Reasons:> a consensus on C<perl5-porters> was that perl should use
2633one non-overridable shell per platform. The obvious choices for OS/2
2634are F<cmd.exe> and F<sh.exe>. Having perl build itself would be impossible
2635with F<cmd.exe> as a shell, thus I picked up C<sh.exe>. This assures almost
2636100% compatibility with the scripts coming from *nix. As an added benefit
2637this works as well under DOS if you use DOS-enabled port of pdksh
2638(see L</Prerequisites>).
2639
2640B<Disadvantages:> currently F<sh.exe> of pdksh calls external programs
2641via fork()/exec(), and there is I<no> functioning exec() on
2642OS/2. exec() is emulated by EMX by an asynchronous call while the caller
2643waits for child completion (to pretend that the C<pid> did not change). This
2644means that 1 I<extra> copy of F<sh.exe> is made active via fork()/exec(),
2645which may lead to some resources taken from the system (even if we do
2646not count extra work needed for fork()ing).
2647
2648Note that this a lesser issue now when we do not spawn F<sh.exe>
2649unless needed (metachars found).
2650
2651One can always start F<cmd.exe> explicitly via
2652
2653  system 'cmd', '/c', 'mycmd', 'arg1', 'arg2', ...
2654
2655If you need to use F<cmd.exe>, and do not want to hand-edit thousands of your
2656scripts, the long-term solution proposed on p5-p is to have a directive
2657
2658  use OS2::Cmd;
2659
2660which will override system(), exec(), C<``>, and
2661C<open(,'...|')>. With current perl you may override only system(),
2662readpipe() - the explicit version of C<``>, and maybe exec(). The code
2663will substitute the one-argument call to system() by
2664C<CORE::system('cmd.exe', '/c', shift)>.
2665
2666If you have some working code for C<OS2::Cmd>, please send it to me,
2667I will include it into distribution. I have no need for such a module, so
2668cannot test it.
2669
2670For the details of the current situation with calling external programs,
2671see L</Starting OSE<sol>2 (and DOS) programs under Perl>.  Set us
2672mention a couple of features:
2673
2674=over 4
2675
2676=item *
2677
2678External scripts may be called by their basename.  Perl will try the same
2679extensions as when processing B<-S> command-line switch.
2680
2681=item *
2682
2683External scripts starting with C<#!> or C<extproc > will be executed directly,
2684without calling the shell, by calling the program specified on the rest of
2685the first line.
2686
2687=back
2688
2689=head2 Memory allocation
2690
2691Perl uses its own malloc() under OS/2 - interpreters are usually malloc-bound
2692for speed, but perl is not, since its malloc is lightning-fast.
2693Perl-memory-usage-tuned benchmarks show that Perl's malloc is 5 times quicker
2694than EMX one.  I do not have convincing data about memory footprint, but
2695a (pretty random) benchmark showed that Perl's one is 5% better.
2696
2697Combination of perl's malloc() and rigid DLL name resolution creates
2698a special problem with library functions which expect their return value to
2699be free()d by system's free(). To facilitate extensions which need to call
2700such functions, system memory-allocation functions are still available with
2701the prefix C<emx_> added. (Currently only DLL perl has this, it should
2702propagate to F<perl_.exe> shortly.)
2703
2704=head2 Threads
2705
2706One can build perl with thread support enabled by providing C<-D usethreads>
2707option to F<Configure>.  Currently OS/2 support of threads is very
2708preliminary.
2709
2710Most notable problems:
2711
2712=over 4
2713
2714=item C<COND_WAIT>
2715
2716may have a race condition (but probably does not due to edge-triggered
2717nature of OS/2 Event semaphores).  (Needs a reimplementation (in terms of chaining
2718waiting threads, with the linked list stored in per-thread structure?)?)
2719
2720=item F<os2.c>
2721
2722has a couple of static variables used in OS/2-specific functions.  (Need to be
2723moved to per-thread structure, or serialized?)
2724
2725=back
2726
2727Note that these problems should not discourage experimenting, since they
2728have a low probability of affecting small programs.
2729
2730=head1 BUGS
2731
2732This description is not updated often (since 5.6.1?), see F<./os2/Changes>
2733for more info.
2734
2735=cut
2736
2737OS/2 extensions
2738~~~~~~~~~~~~~~~
2739I include 3 extensions by Andreas Kaiser, OS2::REXX, OS2::UPM, and OS2::FTP,
2740into my ftp directory, mirrored on CPAN. I made
2741some minor changes needed to compile them by standard tools. I cannot
2742test UPM and FTP, so I will appreciate your feedback. Other extensions
2743there are OS2::ExtAttr, OS2::PrfDB for tied access to EAs and .INI
2744files - and maybe some other extensions at the time you read it.
2745
2746Note that OS2 perl defines 2 pseudo-extension functions
2747OS2::Copy::copy and DynaLoader::mod2fname (many more now, see
2748L</Prebuilt methods>).
2749
2750The -R switch of older perl is deprecated. If you need to call a REXX code
2751which needs access to variables, include the call into a REXX compartment
2752created by
2753	REXX_call {...block...};
2754
2755Two new functions are supported by REXX code,
2756	REXX_eval 'string';
2757	REXX_eval_with 'string', REXX_function_name => \&perl_sub_reference;
2758
2759If you have some other extensions you want to share, send the code to
2760me.  At least two are available: tied access to EA's, and tied access
2761to system databases.
2762
2763=head1 AUTHOR
2764
2765Ilya Zakharevich, cpan@ilyaz.org
2766
2767=head1 SEE ALSO
2768
2769perl(1).
2770
2771=cut
2772
2773

README.os390

1# vim: syntax=pod
2
3This document is written in pod format hence there are punctuation
4characters in odd places. You can read more
5about pod in pod/perlpod.pod or the short summary in the INSTALL file.
6
7=head1 NAME
8
9perlos390 - building and installing Perl for z/OS (previously called OS/390)
10
11=head1 SYNOPSIS
12
13This document will help you Configure, build, test and install Perl
14on z/OS Unix System Services.
15
16=head1 DESCRIPTION
17
18This is a ported Perl for z/OS. It has been tested on z/OS 2.4 and
19should work fine with z/OS 2.5.
20It may work on other versions or releases, but those are
21the ones it has been tested on.
22
23The native character set for z/OS is EBCDIC, but it can also run in ASCII mode.
24Perl can support either, but you have to compile it explicitly for one or the
25other.  You could have both an ASCII perl, and an EBCDIC perl on the same
26machine.  If you use ASCII mode and an ASCII perl, the Encode module shipped
27with perl can be used to translate files from various EBCDIC code pages for
28handling by perl, and then back on output
29
30This document describes how to build a 64-bit Dynamic Perl, either ASCII or
31EBCDIC.  You can interactively choose other configurations, as well as many
32other options in the Configure script that is run as part of the build
33process.  You may need to carry out some system configuration tasks before
34running Configure, as detailed below.
35
36=head2 Tools
37
38You will want to get GNU make 4.1 or later. GNU make can be downloaded from a
39port that Rocket Software provides.  You will need the z/OS c99 compiler from
40IBM (though xlc in c99 mode without optimization turned on works in EBCDIC).
41
42If you want the latest development version of Perl, you will need git.
43You can use git on another platform and transfer the result via sftp or ftp to
44z/OS.  But there is a z/OS native git client port available through Rocket
45Software.
46
47You may also need the gunzip client port that Rocket Software provides to unzip
48any zipped tarball you upload to z/OS.
49
50=head2 Building a 64-bit Dynamic ASCII Perl
51
52For building from an official stable release of Perl, go to
53L<https://www.perl.org/get.html> and choose any one of the
54"Download latest stable source" buttons.  This will get you a tarball.  The
55name of that tarball will be something like 'perl-V.R.M,tar,gz', where V.R.M is
56the version/release/modification of the perl you are downloading. Do
57
58  gunzip perl-V.R.M.tar.gz
59
60Then one of:
61
62  tar -xvf perl-V.R.M.tar
63
64  pax -r -f perl-V.R.M.tar
65
66Either of these will create the source directory.  You can rename it to
67whatever you like; for these instructions, 'perl' is assumed to be the name.
68
69If instead you want the latest unstable development release, using the native
70git on z/OS, clone Perl:
71
72  git clone https://github.com/Perl/perl5.git perl
73
74Either way, once you have a 'perl' directory containing the source, cd into it,
75and tag all the code as ASCII:
76
77  cd perl
78  chtag -R -h -t -cISO8859-1 *
79
80Configure the build environment as 64-bit, Dynamic, ASCII, development,
81deploying it to F</usr/local/perl/ascii>:
82
83  export PATH=$PWD:$PATH
84  export LIBPATH=$PWD:$PATH
85  ./Configure -Dprefix=/usr/local/perl/ascii -des -Dusedevel \
86        -Duse64bitall -Dusedl
87
88If you are building from a stable source, you don't need "-Dusedevel".
89(If you run Configure without options, it will interactively ask you about
90every possible option based on its probing of what's available on your
91particular machine, so you can choose as you go along.)
92
93Run GNU make to build Perl
94
95  make
96
97Run tests to ensure Perl is working correctly. Currently, there are about a
98dozen failing tests out of nearly 2500
99
100  make test_harness
101
102Install Perl into F</usr/local/perl/ascii>:
103
104  make install
105
106=head2 Building a 64-bit Dynamic EBCDIC Perl
107
108You will need a working perl on some box with connectivity to the destination
109machine.  On z/OS, it could be an ASCII perl, or a previous EBCDIC one.
110Many machines will already have a pre-built perl already running, or one can
111easily be downloaded from L<https://www.perl.org/get.html>.
112
113Follow the directions above in "Building a 64-bit Dynamic ASCII Perl" as far as
114getting a populated 'perl' directory.  Then come back here to proceed.
115
116The downloaded perl will need to be converted to 1047 EBCDIC.  To do this:
117
118  cd perl
119  Porting/makerel -e
120
121If the Porting/makerel step fails with an error that it can not issue the tar
122command, proceed to issue the command interactively, where V.R.M is the
123version/release/modification of Perl you are uploading:
124
125  cd ../
126  tar cf -  --format=ustar perl-V.R.M | gzip --best > perl-V.R.M.tar.gz
127
128Use sftp to upload the zipped tar file to z/OS:
129
130  sftp <your system>
131  cd /tmp
132  put perl-V.R.M.tar.gz
133
134Unzip and untar the zipped tar file on z/OS:
135
136  cd /tmp
137  gunzip perl-V.R.M.tar.gz
138
139Then one of:
140
141  tar -xvf perl-V.R.M.tar
142
143  pax -r -f perl-V.R.M.tar
144
145You now have the source code for the EBCDIC Perl on z/OS and can proceed to
146build it. This is analagous to how you would build the code for ASCII, but
147note: you B<should not> tag the code but instead leave it untagged.
148
149Configure the build environment as 64-bit, Dynamic, native, development,
150deploying it to F</usr/local/perl/ebcdic>:
151
152  export PATH=$PWD:$PATH
153  export LIBPATH=$PWD:$PATH
154  ./Configure -Dprefix=/usr/local/perl/ebcdic -des -Dusedevel \
155        -Duse64bitall -Dusedl
156
157If you are building from a stable source, you don't need "-Dusedevel".
158(If you run Configure without options, it will interactively ask you about
159every possible option based on its probing of what's available on your
160particular machine, so you can choose as you go along.)
161
162Run GNU make to build Perl
163
164  make
165
166Run tests to ensure Perl is working correctly.
167
168  make test_harness
169
170You might also want to have GNU groff for OS/390 installed before
171running the "make install" step for Perl.
172
173Install Perl into F</usr/local/perl/ebcdic>:
174
175  make install
176
177EBCDIC Perl is still a work in progress.  All the core code works as far as we
178know, but various modules you might want to download from CPAN do not.  The
179failures range from very minor to catastrophic.  Many of them are simply bugs
180in the tests, with the module actually working properly.  This happens because,
181for example, the test is coded to expect a certain character ASCII code point;
182when it gets the EBCDIC value back instead, it complains.  But the code
183actually worked.  Other potential failures that aren't really failures stem
184from checksums coming out differently, since C<A>, for example, has a different
185bit representation between the character sets.  A test that is expecting the
186ASCII value will show failure, even if the module is working perfectly.  Also
187in sorting, uppercase letters come before lowercase letters on ASCII systems;
188the reverse on EBCDIC.
189
190Some CPAN modules come bundled with the downloaded perl.  And a few of those
191have yet to be fixed to pass on EBCDIC platforms.  As a result they are skipped
192when you run 'make test'.  The current list is:
193
194 Archive::Tar
195 Config::Perl::V
196 CPAN::Meta
197 CPAN::Meta::YAML
198 Digest::MD5
199 Digest::SHA
200 Encode
201 ExtUtils::MakeMaker
202 ExtUtils::Manifest
203 HTTP::Tiny
204 IO::Compress
205 IPC::Cmd
206 JSON::PP
207 libnet
208 MIME::Base64
209 Module::Metadata
210 PerlIO::via-QuotedPrint
211 Pod::Checker
212 podlators
213 Pod::Simple
214 Socket
215 Test::Harness
216
217See also F<hints/os390.sh> for other potential gotchas.
218
219=head2 Setup and utilities for Perl on OS/390
220
221This may also be a good time to ensure that your F</etc/protocol> file
222and either your F</etc/resolv.conf> or F</etc/hosts> files are in place.
223The IBM document that describes such USS system setup issues is
224"z/OS UNIX System Services Planning"
225
226For successful testing you may need to turn on the sticky bit for your
227world readable /tmp directory if you have not already done so (see man chmod).
228
229=head2 Useful files for trouble-shooting
230
231If your configuration is failing, read hints/os390.sh
232This file provides z/OS specific options to direct the build process.
233
234=head3 Shell
235
236A message of the form:
237
238 (I see you are using the Korn shell.  Some ksh's blow up on Configure,
239 mainly on older exotic systems.  If yours does, try the Bourne shell
240 instead.)
241
242is nothing to worry about at all.
243
244=head3 Dynamic loading
245
246Dynamic loading is required if you want to use XS modules from CPAN (like
247DBI (and DBD's), JSON::XS, and Text::CSV_XS) or update CORE modules from
248CPAN with newer versions (like Encode) without rebuilding all of the perl
249binary.
250
251The instructions above will create a dynamic Perl. If you do not want to
252use dynamic loading, remove the -Dusedl option.
253See the comments in hints/os390.sh for more information on dynamic loading.
254
255=head3 Optimizing
256
257Optimization has not been turned on yet. There may be issues if Perl
258is optimized.
259
260=head2 Build Anomalies with Perl on OS/390
261
262"Out of memory!" messages during the build of Perl are most often fixed
263by re building the GNU make utility for OS/390 from a source code kit.
264
265Within USS your F</etc/profile> or F<$HOME/.profile> may limit your ulimit
266settings.  Check that the following command returns reasonable values:
267
268    ulimit -a
269
270To conserve memory you should have your compiler modules loaded into the
271Link Pack Area (LPA/ELPA) rather than in a link list or step lib.
272
273If the compiler complains of syntax errors during the build of the
274Socket extension then be sure to fix the syntax error in the system
275header /usr/include/sys/socket.h.
276
277=head2 Testing Anomalies with Perl on OS/390
278
279The "make test" step runs a Perl Verification Procedure, usually before
280installation.  You might encounter STDERR messages even during a successful
281run of "make test".  Here is a guide to some of the more commonly seen
282anomalies:
283
284=head3 Out of Memory (31-bit only)
285
286Out of memory problems should not be an issue, unless you are attempting to build
287a 31-bit Perl.
288
289If you _are_ building a 31-bit Perl, the constrained environment may mean you
290need to change memory options for Perl.
291In addition to the comments
292above on memory limitations it is also worth checking for _CEE_RUNOPTS
293in your environment. Perl now has (in miniperlmain.c) a C #pragma for 31-bit only
294to set CEE run options, but the environment variable wins.
295
296The 31-bit C code asks for:
297
298 #pragma runopts(HEAP(2M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
299
300The important parts of that are the second argument (the increment) to HEAP,
301and allowing the stack to be "Above the (16M) line". If the heap
302increment is too small then when perl (for example loading unicode/Name.pl) tries
303to create a "big" (400K+) string it cannot fit in a single segment
304and you get "Out of Memory!" - even if there is still plenty of memory
305available.
306
307A related issue is use with perl's malloc. Perl's malloc uses C<sbrk()>
308to get memory, and C<sbrk()> is limited to the first allocation so in this
309case something like:
310
311  HEAP(8M,500K,ANYWHERE,KEEP,8K,4K)
312
313is needed to get through the test suite.
314
315=head2 Usage Hints for Perl on z/OS
316
317When using Perl on z/OS please keep in mind that the EBCDIC and ASCII
318character sets are different.  See L<perlebcdic> for more on such character
319set issues.  Perl builtin functions that may behave differently under
320EBCDIC are also mentioned in the perlport.pod document.
321
322If you are having trouble with square brackets then consider switching your
323rlogin or telnet client.  Try to avoid older 3270 emulators and ISHELL for
324working with Perl on USS.
325
326=head2 Modules and Extensions for Perl on z/OS (Static Only)
327
328Pure Perl (that is non XS) modules may be installed via the usual:
329
330    perl Makefile.PL
331    make
332    make test
333    make install
334
335If you built perl with dynamic loading capability then that would also
336be the way to build XS based extensions.  However, if you built perl with
337static linking you can still build XS based extensions for z/OS
338but you will need to follow the instructions in ExtUtils::MakeMaker for
339building statically linked perl binaries.  In the simplest configurations
340building a static perl + XS extension boils down to:
341
342    perl Makefile.PL
343    make
344    make perl
345    make test
346    make install
347    make -f Makefile.aperl inst_perl MAP_TARGET=perl
348
349=head2 Running Perl on z/OS
350
351To run the 64-bit Dynamic Perl environment, update your PATH and LIBPATH
352to include the location you installed Perl into, and then run the perl you
353installed as perlV.R.M where V/R/M is the Version/Release/Modification level
354of the current development level.
355If you are running the ASCII/EBCDIC Bi-Modal Perl environment, you also need to
356set up your ASCII/EBCDIC Bi-Modal environment variables, and ensure any Perl
357source code you run is tagged appropriately as ASCII or EBCDIC using
358"chtag -t -c<CCSID>":
359
360=over
361
362=item For ASCII Only:
363
364 export _BPXK_AUTOCVT=ON
365 export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG),POSIX(ON)"
366 export _TAG_REDIR_ERR="txt"
367 export _TAG_REDIR_IN="txt"
368 export _TAG_REDIR_OUT="txt"
369
370=item For ASCII or EBCDIC:
371
372 export PATH=/usr/local/perl/ascii:$PATH
373 export LIBPATH=/usr/local/perl/ascii/lib:$LIBPATH
374 perlV.R.M args
375
376=back
377
378If tcsh is your login shell then use the setenv command.
379
380=head1 AUTHORS
381
382David Fiander and Peter Prymmer with thanks to Dennis Longnecker
383and William Raffloer for valuable reports, LPAR and PTF feedback.
384Thanks to Mike MacIsaac and Egon Terwedow for SG24-5944-00.
385Thanks to Ignasi Roca for pointing out the floating point problems.
386Thanks to John Goodyear for dynamic loading help.
387
388Mike Fulton and Karl Williamson have provided updates for UTF8, DLL, 64-bit and
389ASCII/EBCDIC Bi-Modal support
390
391=head1 OTHER SITES
392
393L<https://github.com/ZOSOpenTools/perlport/> provides documentation and tools
394for building various z/OS Perl configurations and has some useful tools in the
395'bin' directory you may want to use for building z/OS Perl yourself.
396
397=head1 HISTORY
398
399Updated 24 December 2021 to enable initial ASCII support
400
401Updated 03 October  2019 for perl-5.33.3+
402
403Updated 28 November 2001 for broken URLs.
404
405Updated 12 March    2001 to mention //'SYS1.TCPPARMS(TCPDATA)'.
406
407Updated 24 January  2001 to mention dynamic loading.
408
409Updated 15 January  2001 for the 5.7.1 release of Perl.
410
411Updated 12 November 2000 for the 5.7.1 release of Perl.
412
413This document was podified for the 5.005_03 release of Perl 11 March 1999.
414
415This document was originally written by David Fiander for the 5.005
416release of Perl.
417
418=cut
419
420

README.os400

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlos400 - Perl version 5 on OS/400
10
11B<This document needs to be updated, but we don't know what it should say.
12Please submit comments to L<https://github.com/Perl/perl5/issues>.>
13
14=head1 DESCRIPTION
15
16This document describes various features of IBM's OS/400 operating
17system that will affect how Perl version 5 (hereafter just Perl) is
18compiled and/or runs.
19
20By far the easiest way to build Perl for OS/400 is to use the PASE
21(Portable Application Solutions Environment), for more information see
22L<http://www.iseries.ibm.com/developer/factory/pase/index.html>
23This environment allows one to use AIX APIs while programming, and it
24provides a runtime that allows AIX binaries to execute directly on the
25PowerPC iSeries.
26
27=head2 Compiling Perl for OS/400 PASE
28
29The recommended way to build Perl for the OS/400 PASE is to build the
30Perl 5 source code (release 5.8.1 or later) under AIX.
31
32The trick is to give a special parameter to the Configure shell script
33when running it on AIX:
34
35  sh Configure -DPASE ...
36
37The default installation directory of Perl under PASE is /QOpenSys/perl.
38This can be modified if needed with Configure parameter -Dprefix=/some/dir.
39
40Starting from OS/400 V5R2 the IBM Visual Age compiler is supported
41on OS/400 PASE, so it is possible to build Perl natively on OS/400.
42The easier way, however, is to compile in AIX, as just described.
43
44If you don't want to install the compiled Perl in AIX into /QOpenSys
45(for packaging it before copying it to PASE), you can use a Configure
46parameter: -Dinstallprefix=/tmp/QOpenSys/perl.  This will cause the
47"make install" to install everything into that directory, while the
48installed files still think they are (will be) in /QOpenSys/perl.
49
50If building natively on PASE, please do the build under the /QOpenSys
51directory, since Perl is happier when built on a case sensitive filesystem.
52
53=head2 Installing Perl in OS/400 PASE
54
55If you are compiling on AIX, simply do a "make install" on the AIX box.
56Once the install finishes, tar up the /QOpenSys/perl directory.  Transfer
57the tarball to the OS/400 using FTP with the following commands:
58
59  > binary
60  > site namefmt 1
61  > put perl.tar /QOpenSys
62
63Once you have it on, simply bring up a PASE shell and extract the tarball.
64
65If you are compiling in PASE, then "make install" is the only thing you
66will need to do.
67
68The default path for perl binary is /QOpenSys/perl/bin/perl.  You'll
69want to symlink /QOpenSys/usr/bin/perl to this file so you don't have
70to modify your path.
71
72=head2 Using Perl in OS/400 PASE
73
74Perl in PASE may be used in the same manner as you would use Perl on AIX.
75
76Scripts starting with #!/usr/bin/perl should work if you have
77/QOpenSys/usr/bin/perl symlinked to your perl binary.  This will not
78work if you've done a setuid/setgid or have environment variable
79PASE_EXEC_QOPENSYS="N".  If you have V5R1, you'll need to get the
80latest PTFs to have this feature.  Scripts starting with
81#!/QOpenSys/perl/bin/perl should always work.
82
83=head2 Known Problems
84
85When compiling in PASE, there is no "oslevel" command.  Therefore,
86you may want to create a script called "oslevel" that echoes the
87level of AIX that your version of PASE runtime supports.  If you're
88unsure, consult your documentation or use "4.3.3.0".
89
90If you have test cases that fail, check for the existence of spool files.
91The test case may be trying to use a syscall that is not implemented
92in PASE.  To avoid the SIGILL, try setting the PASE_SYSCALL_NOSIGILL
93environment variable or have a handler for the SIGILL.  If you can
94compile programs for PASE, run the config script and edit config.sh
95when it gives you the option.  If you want to remove fchdir(), which
96isn't implement in V5R1, simply change the line that says:
97
98d_fchdir='define'
99
100to
101
102d_fchdir='undef'
103
104and then compile Perl.  The places where fchdir() is used have
105alternatives for systems that do not have fchdir() available.
106
107=head2 Perl on ILE
108
109There exists a port of Perl to the ILE environment.  This port, however,
110is based quite an old release of Perl, Perl 5.00502 (August 1998).
111(As of July 2002 the latest release of Perl is 5.8.0, and even 5.6.1
112has been out since April 2001.)  If you need to run Perl on ILE, though,
113you may need this older port: L<http://www.cpan.org/ports/#os400>
114Note that any Perl release later than 5.00502 has not been ported to ILE.
115
116If you need to use Perl in the ILE environment, you may want to consider
117using Qp2RunPase() to call the PASE version of Perl.
118
119=head1 AUTHORS
120
121Jarkko Hietaniemi <jhi@iki.fi>
122Bryan Logan <bryanlog@us.ibm.com>
123David Larson <larson1@us.ibm.com>
124
125=cut
126

README.plan9

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlplan9 - Plan 9-specific documentation for Perl
10
11=head1 DESCRIPTION
12
13These are a few notes describing features peculiar to
14Plan 9 Perl. As such, it is not intended to be a replacement
15for the rest of the Perl 5 documentation (which is both
16copious and excellent). If you have any questions to
17which you can't find answers in these man pages, contact
18Luther Huffman at lutherh@stratcom.com and we'll try to
19answer them.
20
21=head2 Invoking Perl
22
23Perl is invoked from the command line as described in
24L<perl>. Most perl scripts, however, do have a first line
25such as "#!/usr/local/bin/perl". This is known as a shebang
26(shell-bang) statement and tells the OS shell where to find
27the perl interpreter. In Plan 9 Perl this statement should be
28"#!/bin/perl" if you wish to be able to directly invoke the
29script by its name.
30     Alternatively, you may invoke perl with the command "Perl"
31instead of "perl". This will produce Acme-friendly error
32messages of the form "filename:18".
33
34Some scripts, usually identified with a *.PL extension, are
35self-configuring and are able to correctly create their own
36shebang path from config information located in Plan 9
37Perl. These you won't need to be worried about.
38
39=head2 What's in Plan 9 Perl
40
41Although Plan 9 Perl currently only  provides static
42loading, it is built with a number of useful extensions.
43These include Opcode, FileHandle, Fcntl, and POSIX. Expect
44to see others (and DynaLoading!) in the future.
45
46=head2 What's not in Plan 9 Perl
47
48As mentioned previously, dynamic loading isn't currently
49available nor is MakeMaker. Both are high-priority items.
50
51=head2 Perl5 Functions not currently supported in Plan 9 Perl
52
53Some, such as C<chown> and C<umask> aren't provided
54because the concept does not exist within Plan 9. Others,
55such as some of the socket-related functions, simply
56haven't been written yet. Many in the latter category
57may be supported in the future.
58
59The functions not currently implemented include:
60
61    chown, chroot, dbmclose, dbmopen, getsockopt,
62    setsockopt, recvmsg, sendmsg, getnetbyname,
63    getnetbyaddr, getnetent, getprotoent, getservent,
64    sethostent, setnetent, setprotoent, setservent,
65    endservent, endnetent, endprotoent, umask
66
67There may be several other functions that have undefined
68behavior so this list shouldn't be considered complete.
69
70=head2 Signals in Plan 9 Perl
71
72For compatibility with perl scripts written for the Unix
73environment, Plan 9 Perl uses the POSIX signal emulation
74provided in Plan 9's ANSI POSIX Environment (APE). Signal stacking
75isn't supported. The signals provided are:
76
77    SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT,
78    SIGFPE, SIGKILL, SIGSEGV, SIGPIPE, SIGPIPE, SIGALRM,
79    SIGTERM, SIGUSR1, SIGUSR2, SIGCHLD, SIGCONT,
80    SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU
81
82=head1 COMPILING AND INSTALLING PERL ON PLAN 9
83
84WELCOME to Plan 9 Perl, brave soul!
85
86   This is a preliminary alpha version of Plan 9 Perl. Still to be
87implemented are MakeMaker and DynaLoader. Many perl commands are
88missing or currently behave in an inscrutable manner. These gaps will,
89with perseverance and a modicum of luck, be remedied in the near
90future.To install this software:
91
921. Create the source directories and libraries for perl by running the
93plan9/setup.rc command (i.e., located in the plan9 subdirectory).
94Note: the setup routine assumes that you haven't dearchived these
95files into /sys/src/cmd/perl. After running setup.rc you may delete
96the copy of the source you originally detarred, as source code has now
97been installed in /sys/src/cmd/perl. If you plan on installing perl
98binaries for all architectures, run "setup.rc -a".
99
1002. After making sure that you have adequate privileges to build system
101software, from /sys/src/cmd/perl/5.00301 (adjust version
102appropriately) run:
103
104	mk install
105
106If you wish to install perl versions for all architectures (68020,
107mips, sparc and 386) run:
108
109	mk installall
110
1113. Wait. The build process will take a *long* time because perl
112bootstraps itself. A 75MHz Pentium, 16MB RAM machine takes roughly 30
113minutes to build the distribution from scratch.
114
115=head2 Installing Perl Documentation on Plan 9
116
117This perl distribution comes with a tremendous amount of
118documentation. To add these to the built-in manuals that come with
119Plan 9, from /sys/src/cmd/perl/5.00301 (adjust version appropriately)
120run:
121
122	mk man
123
124To begin your reading, start with:
125
126	man perl
127
128This is a good introduction and will direct you towards other man
129pages that may interest you.
130
131(Note: "mk man" may produce some extraneous noise. Fear not.)
132
133=head1 BUGS
134
135"As many as there are grains of sand on all the beaches of the
136world . . ." - Carl Sagan
137
138=head1 Revision date
139
140This document was revised 09-October-1996 for Perl 5.003_7.
141
142=head1 AUTHOR
143
144Direct questions, comments, and the unlikely bug report (ahem) direct
145comments toward:
146
147Luther Huffman, lutherh@stratcom.com,
148Strategic Computer Solutions, Inc.
149

README.qnx

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perlqnx - Perl version 5 on QNX
10
11=head1 DESCRIPTION
12
13As of perl5.7.2 all tests pass under:
14
15  QNX 4.24G
16  Watcom 10.6 with Beta/970211.wcc.update.tar.F
17  socket3r.lib Nov21 1996.
18
19As of perl5.8.1 there is at least one test still failing.
20
21Some tests may complain under known circumstances.
22
23See below and hints/qnx.sh for more information.
24
25Under QNX 6.2.0 there are still a few tests which fail.
26See below and hints/qnx.sh for more information.
27
28=head2 Required Software for Compiling Perl on QNX4
29
30As with many unix ports, this one depends on a few "standard"
31unix utilities which are not necessarily standard for QNX4.
32
33=over 4
34
35=item /bin/sh
36
37This is used heavily by Configure and then by
38perl itself. QNX4's version is fine, but Configure
39will choke on the 16-bit version, so if you are
40running QNX 4.22, link /bin/sh to /bin32/ksh
41
42=item ar
43
44This is the standard unix library builder.
45We use wlib. With Watcom 10.6, when wlib is
46linked as "ar", it behaves like ar and all is
47fine. Under 9.5, a cover is required. One is
48included in ../qnx
49
50=item nm
51
52This is used (optionally) by configure to list
53the contents of libraries. I will generate
54a cover function on the fly in the UU directory.
55
56=item cpp
57
58Configure and perl need a way to invoke a C
59preprocessor. I have created a simple cover
60for cc which does the right thing. Without this,
61Configure will create its own wrapper which works,
62but it doesn't handle some of the command line arguments
63that perl will throw at it.
64
65=item make
66
67You really need GNU make to compile this. GNU make
68ships by default with QNX 4.23, but you can get it
69from quics for earlier versions.
70
71=back
72
73=head2 Outstanding Issues with Perl on QNX4
74
75There is no support for dynamically linked libraries in QNX4.
76
77If you wish to compile with the Socket extension, you need
78to have the TCP/IP toolkit, and you need to make sure that
79-lsocket locates the correct copy of socket3r.lib. Beware
80that the Watcom compiler ships with a stub version of
81socket3r.lib which has very little functionality. Also
82beware the order in which wlink searches directories for
83libraries. You may have /usr/lib/socket3r.lib pointing to
84the correct library, but wlink may pick up
85/usr/watcom/10.6/usr/lib/socket3r.lib instead. Make sure
86they both point to the correct library, that is,
87/usr/tcptk/current/usr/lib/socket3r.lib.
88
89The following tests may report errors under QNX4:
90
91dist/Cwd/Cwd.t will complain if `pwd` and cwd don't give
92the same results. cwd calls `fullpath -t`, so if you
93cd `fullpath -t` before running the test, it will
94pass.
95
96lib/File/Find/taint.t will complain if '.' is in your
97PATH. The PATH test is triggered because cwd calls
98`fullpath -t`.
99
100ext/IO/lib/IO/t/io_sock.t: Subtests 14 and 22 are skipped due to
101the fact that the functionality to read back the non-blocking
102status of a socket is not implemented in QNX's TCP/IP. This has
103been reported to QNX and it may work with later versions of
104TCP/IP.
105
106t/io/tell.t: Subtest 27 is failing. We are still investigating.
107
108=head2 QNX auxiliary files
109
110The files in the "qnx" directory are:
111
112=over 4
113
114=item qnx/ar
115
116A script that emulates the standard unix archive (aka library)
117utility.  Under Watcom 10.6, ar is linked to wlib and provides the
118expected interface. With Watcom 9.5, a cover function is
119required. This one is fairly crude but has proved adequate for
120compiling perl.
121
122=item qnx/cpp
123
124A script that provides C preprocessing functionality.  Configure can
125generate a similar cover, but it doesn't handle all the command-line
126options that perl throws at it. This might be reasonably placed in
127/usr/local/bin.
128
129=back
130
131=head2 Outstanding issues with perl under QNX6
132
133The following tests are still failing for Perl 5.8.1 under QNX 6.2.0:
134
135  op/sprintf.........................FAILED at test 91
136  lib/Benchmark......................FAILED at test 26
137
138This is due to a bug in the C library's printf routine.
139printf("'%e'", 0. ) produces '0.000000e+0', but ANSI requires
140'0.000000e+00'. QNX has acknowledged the bug.
141
142=head2 Cross-compilation
143
144Perl supports cross-compiling to QNX NTO through the
145Native Development Kit (NDK) for the Blackberry 10.  This means that you
146can cross-compile for both ARM and x86 versions of the platform.
147
148=head3 Setting up a cross-compilation environment
149
150You can download the NDK from
151L<http://developer.blackberry.com/native/downloads/>.
152
153See
154L<http://developer.blackberry.com/native/documentation/cascades/getting_started/setting_up.html>
155for instructions to set up your device prior to attempting anything else.
156
157Once you've installed the NDK and set up your device, all that's
158left to do is setting up the device and the cross-compilation
159environment.  Blackberry provides a script, C<bbndk-env.sh> (occasionally
160named something like C<bbndk-env_10_1_0_4828.sh>) which can be used
161to do this.  However, there's a bit of a snag that we have to work through:
162The script modifies PATH so that 'gcc' or 'ar' point to their
163cross-compilation equivalents, which screws over the build process.
164
165So instead you'll want to do something like this:
166
167    $ orig_path=$PATH
168    $ source $location_of_bbndk/bbndk-env*.sh
169    $ export PATH="$orig_path:$PATH"
170
171Besides putting the cross-compiler and the rest of the toolchain in your
172PATH, this will also provide the QNX_TARGET variable, which
173we will pass to Configure through -Dsysroot.
174
175=head3 Preparing the target system
176
177It's quite possible that the target system doesn't have a readily
178available /tmp, so it's generally safer to do something like this:
179
180 $ ssh $TARGETUSER@$TARGETHOST 'rm -rf perl; mkdir perl; mkdir perl/tmp'
181 $ export TARGETDIR=`ssh $TARGETUSER@$TARGETHOST pwd`/perl
182 $ export TARGETENV="export TMPDIR=$TARGETDIR/tmp; "
183
184Later on, we'll pass this to Configure through -Dtargetenv
185
186=head3 Calling Configure
187
188If you are targetting an ARM device -- which currently includes the vast
189majority of phones and tablets -- you'll want to pass
190-Dcc=arm-unknown-nto-qnx8.0.0eabi-gcc to Configure.  Alternatively, if you
191are targetting an x86 device, or using the simulator provided with the NDK,
192you should specify -Dcc=ntox86-gcc instead.
193
194A sample Configure invocation looks something like this:
195
196    ./Configure -des -Dusecrosscompile \
197        -Dsysroot=$QNX_TARGET          \
198        -Dtargetdir=$TARGETDIR         \
199        -Dtargetenv="$TARGETENV"       \
200        -Dcc=ntox86-gcc                \
201        -Dtarghost=... # Usual cross-compilation options
202
203=head1 AUTHOR
204
205Norton T. Allen (allen@huarp.harvard.edu)
206
207

README.riscos

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see.  It is written in the POD format (see pod/perlpod.pod) which is
5specifically designed to be readable as is.
6
7=head1 NAME
8
9perlriscos - Perl version 5 for RISC OS
10
11=head1 DESCRIPTION
12
13This document gives instructions for building Perl for RISC OS. It is
14complicated by the need to cross compile. There is a binary version of
15perl available from L<http://www.cp15.org/perl/> which you may wish to
16use instead of trying to compile it yourself.
17
18=head1 BUILD
19
20You need an installed and working gccsdk cross compiler
21L<http://gccsdk.riscos.info/> and REXEN
22L<http://www.cp15.org/programming/>
23
24Firstly, copy the source and build a native copy of perl for your host
25system.
26Then, in the source to be cross compiled:
27
28=over 4
29
30=item 1.
31
32    $ ./Configure
33
34=item 2.
35
36Select the riscos hint file. The default answers for the rest of the
37questions are usually sufficient.
38
39Note that, if you wish to run Configure non-interactively (see the INSTALL
40document for details), to have it select the correct hint file, you'll
41need to provide the argument -Dhintfile=riscos on the Configure
42command-line.
43
44=item 3.
45
46    $ make miniperl
47
48=item 4.
49
50This should build miniperl and then fail when it tries to run it.
51
52=item 5.
53
54Copy the miniperl executable from the native build done earlier to
55replace the cross compiled miniperl.
56
57=item 6.
58
59    $ make
60
61=item 7.
62
63This will use miniperl to complete the rest of the build.
64
65=back
66
67=head1 AUTHOR
68
69Alex Waugh <alex@alexwaugh.com>
70

README.solaris

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see.  It is written in the POD format (see pod/perlpod.pod) which is
5specifically designed to be readable as is.
6
7=head1 NAME
8
9perlsolaris - Perl version 5 on Solaris systems
10
11=head1 DESCRIPTION
12
13This document describes various features of Sun's Solaris operating system
14that will affect how Perl version 5 (hereafter just perl) is
15compiled and/or runs.  Some issues relating to the older SunOS 4.x are
16also discussed, though they may be out of date.
17
18For the most part, everything should just work.
19
20Starting with Solaris 8, perl5.00503 (or higher) is supplied with the
21operating system, so you might not even need to build a newer version
22of perl at all.  The Sun-supplied version is installed in /usr/perl5
23with F</usr/bin/perl> pointing to F</usr/perl5/bin/perl>.  Do not disturb
24that installation unless you really know what you are doing.  If you
25remove the perl supplied with the OS, you will render some bits of
26your system inoperable.  If you wish to install a newer version of perl,
27install it under a different prefix from /usr/perl5.  Common prefixes
28to use are /usr/local and /opt/perl.
29
30You may wish to put your version of perl in the PATH of all users by
31changing the link F</usr/bin/perl>.  This is probably OK, as most perl
32scripts shipped with Solaris use an explicit path.  (There are a few
33exceptions, such as F</usr/bin/rpm2cpio> and F</etc/rcm/scripts/README>, but
34these are also sufficiently generic that the actual version of perl
35probably doesn't matter too much.)
36
37Solaris ships with a range of Solaris-specific modules.  If you choose
38to install your own version of perl you will find the source of many of
39these modules is available on CPAN under the Sun::Solaris:: namespace.
40
41Solaris may include two versions of perl, e.g. Solaris 9 includes
42both 5.005_03 and 5.6.1.  This is to provide stability across Solaris
43releases, in cases where a later perl version has incompatibilities
44with the version included in the preceding Solaris release.  The
45default perl version will always be the most recent, and in general
46the old version will only be retained for one Solaris release.  Note
47also that the default perl will NOT be configured to search for modules
48in the older version, again due to compatibility/stability concerns.
49As a consequence if you upgrade Solaris, you will have to
50rebuild/reinstall any additional CPAN modules that you installed for
51the previous Solaris version.  See the CPAN manpage under 'autobundle'
52for a quick way of doing this.
53
54As an interim measure, you may either change the #! line of your
55scripts to specifically refer to the old perl version, e.g. on
56Solaris 9 use #!/usr/perl5/5.00503/bin/perl to use the perl version
57that was the default for Solaris 8, or if you have a large number of
58scripts it may be more convenient to make the old version of perl the
59default on your system.  You can do this by changing the appropriate
60symlinks under /usr/perl5 as follows (example for Solaris 9):
61
62 # cd /usr/perl5
63 # rm bin man pod
64 # ln -s ./5.00503/bin
65 # ln -s ./5.00503/man
66 # ln -s ./5.00503/lib/pod
67 # rm /usr/bin/perl
68 # ln -s ../perl5/5.00503/bin/perl /usr/bin/perl
69
70In both cases this should only be considered to be a temporary
71measure - you should upgrade to the later version of perl as soon as
72is practicable.
73
74Note also that the perl command-line utilities (e.g. perldoc) and any
75that are added by modules that you install will be under
76/usr/perl5/bin, so that directory should be added to your PATH.
77
78=head2 Solaris Version Numbers.
79
80For consistency with common usage, perl's Configure script performs
81some minor manipulations on the operating system name and version
82number as reported by uname.  Here's a partial translation table:
83
84          Sun:                      perl's Configure:
85 uname    uname -r   Name           osname     osvers
86 SunOS    4.1.3     Solaris 1.1     sunos      4.1.3
87 SunOS    5.6       Solaris 2.6     solaris    2.6
88 SunOS    5.8       Solaris 8       solaris    2.8
89 SunOS    5.9       Solaris 9       solaris    2.9
90 SunOS    5.10      Solaris 10      solaris    2.10
91
92The complete table can be found in the Sun Managers' FAQ
93L<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq> under
94"9.1) Which Sun models run which versions of SunOS?".
95
96=head1 RESOURCES
97
98There are many, many sources for Solaris information.  A few of the
99important ones for perl:
100
101=over 4
102
103=item Solaris FAQ
104
105The Solaris FAQ is available at
106L<http://www.science.uva.nl/pub/solaris/solaris2.html>.
107
108The Sun Managers' FAQ is available at
109L<ftp://ftp.cs.toronto.edu/pub/jdd/sunmanagers/faq>
110
111=item Precompiled Binaries
112
113Precompiled binaries, links to many sites, and much, much more are
114available at L<http://www.sunfreeware.com/> and
115L<http://www.blastwave.org/>.
116
117=item Solaris Documentation
118
119All Solaris documentation is available on-line at L<http://docs.sun.com/>.
120
121=back
122
123=head1 SETTING UP
124
125=head2 File Extraction Problems on Solaris.
126
127Be sure to use a tar program compiled under Solaris (not SunOS 4.x)
128to extract the perl-5.x.x.tar.gz file.  Do not use GNU tar compiled
129for SunOS4 on Solaris.  (GNU tar compiled for Solaris should be fine.)
130When you run SunOS4 binaries on Solaris, the run-time system magically
131alters pathnames matching m#lib/locale# so that when tar tries to create
132lib/locale.pm, a file named lib/oldlocale.pm gets created instead.
133If you found this advice too late and used a SunOS4-compiled tar
134anyway, you must find the incorrectly renamed file and move it back
135to lib/locale.pm.
136
137=head2 Compiler and Related Tools on Solaris.
138
139You must use an ANSI C compiler to build perl.  Perl can be compiled
140with either Sun's add-on C compiler or with gcc.  The C compiler that
141shipped with SunOS4 will not do.
142
143=head3 Include /usr/ccs/bin/ in your PATH.
144
145Several tools needed to build perl are located in /usr/ccs/bin/:  ar,
146as, ld, and make.  Make sure that /usr/ccs/bin/ is in your PATH.
147
148
149On all the released versions of Solaris (8, 9 and 10) you need to make sure the following packages are installed (this info is extracted from the Solaris FAQ):
150
151for tools (sccs, lex, yacc, make, nm, truss, ld, as): SUNWbtool,
152SUNWsprot, SUNWtoo
153
154for libraries & headers: SUNWhea, SUNWarc, SUNWlibm, SUNWlibms, SUNWdfbh,
155SUNWcg6h, SUNWxwinc
156
157Additionally, on Solaris 8 and 9 you also need:
158
159for 64 bit development: SUNWarcx, SUNWbtoox, SUNWdplx, SUNWscpux,
160SUNWsprox, SUNWtoox, SUNWlmsx, SUNWlmx, SUNWlibCx
161
162And only on Solaris 8 you also need:
163
164for libraries & headers: SUNWolinc
165
166
167If you are in doubt which package contains a file you are missing,
168try to find an installation that has that file. Then do a
169
170 $ grep /my/missing/file /var/sadm/install/contents
171
172This will display a line like this:
173
174/usr/include/sys/errno.h f none 0644 root bin 7471 37605 956241356 SUNWhea
175
176The last item listed (SUNWhea in this example) is the package you need.
177
178=head3 Avoid /usr/ucb/cc.
179
180You don't need to have /usr/ucb/ in your PATH to build perl.  If you
181want /usr/ucb/ in your PATH anyway, make sure that /usr/ucb/ is NOT
182in your PATH before the directory containing the right C compiler.
183
184=head3 Sun's C Compiler
185
186If you use Sun's C compiler, make sure the correct directory
187(usually /opt/SUNWspro/bin/) is in your PATH (before /usr/ucb/).
188
189=head3 GCC
190
191If you use gcc, make sure your installation is recent and complete.
192perl versions since 5.6.0 build fine with gcc > 2.8.1 on Solaris >=
1932.6.
194
195You must Configure perl with
196
197 $ sh Configure -Dcc=gcc
198
199If you don't, you may experience strange build errors.
200
201If you have updated your Solaris version, you may also have to update
202your gcc.  For example, if you are running Solaris 2.6 and your gcc is
203installed under /usr/local, check in /usr/local/lib/gcc-lib and make
204sure you have the appropriate directory, sparc-sun-solaris2.6/ or
205i386-pc-solaris2.6/.  If gcc's directory is for a different version of
206Solaris than you are running, then you will need to rebuild gcc for
207your new version of Solaris.
208
209You can get a precompiled version of gcc from
210L<http://www.sunfreeware.com/> or L<http://www.blastwave.org/>. Make
211sure you pick up the package for your Solaris release.
212
213If you wish to use gcc to build add-on modules for use with the perl
214shipped with Solaris, you should use the Solaris::PerlGcc module
215which is available from CPAN.  The perl shipped with Solaris
216is configured and built with the Sun compilers, and the compiler
217configuration information stored in Config.pm is therefore only
218relevant to the Sun compilers.  The Solaris:PerlGcc module contains a
219replacement Config.pm that is correct for gcc - see the module for
220details.
221
222=head3 GNU as and GNU ld
223
224The following information applies to gcc version 2.  Volunteers to
225update it as appropriately for gcc version 3 would be appreciated.
226
227The versions of as and ld supplied with Solaris work fine for building
228perl.  There is normally no need to install the GNU versions to
229compile perl.
230
231If you decide to ignore this advice and use the GNU versions anyway,
232then be sure that they are relatively recent.  Versions newer than 2.7
233are apparently new enough.  Older versions may have trouble with
234dynamic loading.
235
236If you wish to use GNU ld, then you need to pass it the -Wl,-E flag.
237The hints/solaris_2.sh file tries to do this automatically by setting
238the following Configure variables:
239
240 ccdlflags="$ccdlflags -Wl,-E"
241 lddlflags="$lddlflags -Wl,-E -G"
242
243However, over the years, changes in gcc, GNU ld, and Solaris ld have made
244it difficult to automatically detect which ld ultimately gets called.
245You may have to manually edit config.sh and add the -Wl,-E flags
246yourself, or else run Configure interactively and add the flags at the
247appropriate prompts.
248
249If your gcc is configured to use GNU as and ld but you want to use the
250Solaris ones instead to build perl, then you'll need to add
251-B/usr/ccs/bin/ to the gcc command line.  One convenient way to do
252that is with
253
254 $ sh Configure -Dcc='gcc -B/usr/ccs/bin/'
255
256Note that the trailing slash is required.  This will result in some
257harmless warnings as Configure is run:
258
259 gcc: file path prefix `/usr/ccs/bin/' never used
260
261These messages may safely be ignored.
262(Note that for a SunOS4 system, you must use -B/bin/ instead.)
263
264Alternatively, you can use the GCC_EXEC_PREFIX environment variable to
265ensure that Sun's as and ld are used.  Consult your gcc documentation
266for further information on the -B option and the GCC_EXEC_PREFIX variable.
267
268=head3 Sun and GNU make
269
270The make under /usr/ccs/bin works fine for building perl.  If you
271have the Sun C compilers, you will also have a parallel version of
272make (dmake).  This works fine to build perl, but can sometimes cause
273problems when running 'make test' due to underspecified dependencies
274between the different test harness files.  The same problem can also
275affect the building of some add-on modules, so in those cases either
276specify '-m serial' on the dmake command line, or use
277/usr/ccs/bin/make instead.  If you wish to use GNU make, be sure that
278the set-group-id bit is not set.  If it is, then arrange your PATH so
279that /usr/ccs/bin/make is before GNU make or else have the system
280administrator disable the set-group-id bit on GNU make.
281
282=head3 Avoid libucb.
283
284Solaris provides some BSD-compatibility functions in /usr/ucblib/libucb.a.
285Perl will not build and run correctly if linked against -lucb since it
286contains routines that are incompatible with the standard Solaris libc.
287Normally this is not a problem since the solaris hints file prevents
288Configure from even looking in /usr/ucblib for libraries, and also
289explicitly omits -lucb.
290
291=head2 Environment for Compiling perl on Solaris
292
293=head3 PATH
294
295Make sure your PATH includes the compiler (/opt/SUNWspro/bin/ if you're
296using Sun's compiler) as well as /usr/ccs/bin/ to pick up the other
297development tools (such as make, ar, as, and ld).  Make sure your path
298either doesn't include /usr/ucb or that it includes it after the
299compiler and compiler tools and other standard Solaris directories.
300You definitely don't want /usr/ucb/cc.
301
302=head3 LD_LIBRARY_PATH
303
304If you have the LD_LIBRARY_PATH environment variable set, be sure that
305it does NOT include /lib or /usr/lib.  If you will be building
306extensions that call third-party shared libraries (e.g. Berkeley DB)
307then make sure that your LD_LIBRARY_PATH environment variable includes
308the directory with that library (e.g. /usr/local/lib).
309
310If you get an error message
311
312 dlopen: stub interception failed
313
314it is probably because your LD_LIBRARY_PATH environment variable
315includes a directory which is a symlink to /usr/lib (such as /lib).
316The reason this causes a problem is quite subtle.  The file
317libdl.so.1.0 actually *only* contains functions which generate 'stub
318interception failed' errors!  The runtime linker intercepts links to
319"/usr/lib/libdl.so.1.0" and links in internal implementations of those
320functions instead.  [Thanks to Tim Bunce for this explanation.]
321
322=head1 RUN CONFIGURE.
323
324See the INSTALL file for general information regarding Configure.
325Only Solaris-specific issues are discussed here.  Usually, the
326defaults should be fine.
327
328=head2 64-bit perl on Solaris.
329
330See the INSTALL file for general information regarding 64-bit compiles.
331In general, the defaults should be fine for most people.
332
333By default, perl-5.6.0 (or later) is compiled as a 32-bit application
334with largefile and long-long support.
335
336=head3 General 32-bit vs. 64-bit issues.
337
338Solaris 7 and above will run in either 32 bit or 64 bit mode on SPARC
339CPUs, via a reboot. You can build 64 bit apps whilst running 32 bit
340mode and vice-versa. 32 bit apps will run under Solaris running in
341either 32 or 64 bit mode.  64 bit apps require Solaris to be running
34264 bit mode.
343
344Existing 32 bit apps are properly known as LP32, i.e. Longs and
345Pointers are 32 bit.  64-bit apps are more properly known as LP64.
346The discriminating feature of a LP64 bit app is its ability to utilise a
34764-bit address space.  It is perfectly possible to have a LP32 bit app
348that supports both 64-bit integers (long long) and largefiles (> 2GB),
349and this is the default for perl-5.6.0.
350
351For a more complete explanation of 64-bit issues, see the
352"Solaris 64-bit Developer's Guide" at L<http://docs.sun.com/>
353
354You can detect the OS mode using "isainfo -v", e.g.
355
356 $ isainfo -v   # Ultra 30 in 64 bit mode
357 64-bit sparcv9 applications
358 32-bit sparc applications
359
360By default, perl will be compiled as a 32-bit application.  Unless
361you want to allocate more than ~ 4GB of memory inside perl, or unless
362you need more than 255 open file descriptors, you probably don't need
363perl to be a 64-bit app.
364
365=head3 Large File Support
366
367For Solaris 2.6 and onwards, there are two different ways for 32-bit
368applications to manipulate large files (files whose size is > 2GByte).
369(A 64-bit application automatically has largefile support built in
370by default.)
371
372First is the "transitional compilation environment", described in
373lfcompile64(5).  According to the man page,
374
375 The transitional compilation  environment  exports  all  the
376 explicit 64-bit functions (xxx64()) and types in addition to
377 all the regular functions (xxx()) and types. Both xxx()  and
378 xxx64()  functions  are  available to the program source.  A
379 32-bit application must use the xxx64() functions in  order
380 to  access  large  files.  See the lf64(5) manual page for a
381 complete listing of the 64-bit transitional interfaces.
382
383The transitional compilation environment is obtained with the
384following compiler and linker flags:
385
386 getconf LFS64_CFLAGS        -D_LARGEFILE64_SOURCE
387 getconf LFS64_LDFLAG        # nothing special needed
388 getconf LFS64_LIBS          # nothing special needed
389
390Second is the "large file compilation environment", described in
391lfcompile(5).  According to the man page,
392
393 Each interface named xxx() that needs to access 64-bit entities
394 to  access  large  files maps to a xxx64() call in the
395 resulting binary. All relevant data types are defined to  be
396 of correct size (for example, off_t has a typedef definition
397 for a 64-bit entity).
398
399 An application compiled in this environment is able  to  use
400 the  xxx()  source interfaces to access both large and small
401 files, rather than having to explicitly utilize the  transitional
402 xxx64()  interface  calls to access large files.
403
404Two exceptions are fseek() and ftell().  32-bit applications should
405use fseeko(3C) and ftello(3C).  These will get automatically mapped
406to fseeko64() and ftello64().
407
408The large file compilation environment is obtained with
409
410 getconf LFS_CFLAGS      -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
411 getconf LFS_LDFLAGS     # nothing special needed
412 getconf LFS_LIBS        # nothing special needed
413
414By default, perl uses the large file compilation environment and
415relies on Solaris to do the underlying mapping of interfaces.
416
417=head3 Building an LP64 perl
418
419To compile a 64-bit application on an UltraSparc with a recent Sun Compiler,
420you need to use the flag "-xarch=v9".  getconf(1) will tell you this, e.g.
421
422 $ getconf -a | grep v9
423 XBS5_LP64_OFF64_CFLAGS:         -xarch=v9
424 XBS5_LP64_OFF64_LDFLAGS:        -xarch=v9
425 XBS5_LP64_OFF64_LINTFLAGS:      -xarch=v9
426 XBS5_LPBIG_OFFBIG_CFLAGS:       -xarch=v9
427 XBS5_LPBIG_OFFBIG_LDFLAGS:      -xarch=v9
428 XBS5_LPBIG_OFFBIG_LINTFLAGS:    -xarch=v9
429 _XBS5_LP64_OFF64_CFLAGS:        -xarch=v9
430 _XBS5_LP64_OFF64_LDFLAGS:       -xarch=v9
431 _XBS5_LP64_OFF64_LINTFLAGS:     -xarch=v9
432 _XBS5_LPBIG_OFFBIG_CFLAGS:      -xarch=v9
433 _XBS5_LPBIG_OFFBIG_LDFLAGS:     -xarch=v9
434 _XBS5_LPBIG_OFFBIG_LINTFLAGS:   -xarch=v9
435
436This flag is supported in Sun WorkShop Compilers 5.0 and onwards
437(now marketed under the name Forte) when used on Solaris 7 or later on
438UltraSparc systems.
439
440If you are using gcc, you would need to use -mcpu=v9 -m64 instead.  This
441option is not yet supported as of gcc 2.95.2; from install/SPECIFIC
442in that release:
443
444 GCC version 2.95 is not able to compile code correctly for sparc64
445 targets. Users of the Linux kernel, at least, can use the sparc32
446 program to start up a new shell invocation with an environment that
447 causes configure to recognize (via uname -a) the system as sparc-*-*
448 instead.
449
450All this should be handled automatically by the hints file, if
451requested.
452
453=head3 Long Doubles.
454
455As of 5.8.1, long doubles are working if you use the Sun compilers
456(needed for additional math routines not included in libm).
457
458=head2 Threads in perl on Solaris.
459
460It is possible to build a threaded version of perl on Solaris.  The entire
461perl thread implementation is still experimental, however, so beware.
462
463=head2 Malloc Issues with perl on Solaris.
464
465Starting from perl 5.7.1 perl uses the Solaris malloc, since the perl
466malloc breaks when dealing with more than 2GB of memory, and the Solaris
467malloc also seems to be faster.
468
469If you for some reason (such as binary backward compatibility) really
470need to use perl's malloc, you can rebuild perl from the sources
471and Configure the build with
472
473 $ sh Configure -Dusemymalloc
474
475You should not use perl's malloc if you are building with gcc.  There
476are reports of core dumps, especially in the PDL module.  The problem
477appears to go away under -DDEBUGGING, so it has been difficult to
478track down.  Sun's compiler appears to be okay with or without perl's
479malloc. [XXX further investigation is needed here.]
480
481=head1 MAKE PROBLEMS.
482
483=over 4
484
485=item Dynamic Loading Problems With GNU as and GNU ld
486
487If you have problems with dynamic loading using gcc on SunOS or
488Solaris, and you are using GNU as and GNU ld, see the section
489L</"GNU as and GNU ld"> above.
490
491=item ld.so.1: ./perl: fatal: relocation error:
492
493If you get this message on SunOS or Solaris, and you're using gcc,
494it's probably the GNU as or GNU ld problem in the previous item
495L</"GNU as and GNU ld">.
496
497=item dlopen: stub interception failed
498
499The primary cause of the 'dlopen: stub interception failed' message is
500that the LD_LIBRARY_PATH environment variable includes a directory
501which is a symlink to /usr/lib (such as /lib).  See
502L</"LD_LIBRARY_PATH"> above.
503
504=item #error "No DATAMODEL_NATIVE specified"
505
506This is a common error when trying to build perl on Solaris 2.6 with a
507gcc installation from Solaris 2.5 or 2.5.1.  The Solaris header files
508changed, so you need to update your gcc installation.  You can either
509rerun the fixincludes script from gcc or take the opportunity to
510update your gcc installation.
511
512=item sh: ar: not found
513
514This is a message from your shell telling you that the command 'ar'
515was not found.  You need to check your PATH environment variable to
516make sure that it includes the directory with the 'ar' command.  This
517is a common problem on Solaris, where 'ar' is in the /usr/ccs/bin/
518directory.
519
520=back
521
522=head1 MAKE TEST
523
524=head2 op/stat.t test 4 in Solaris
525
526F<op/stat.t> test 4 may fail if you are on a tmpfs of some sort.
527Building in /tmp sometimes shows this behavior.  The
528test suite detects if you are building in /tmp, but it may not be able
529to catch all tmpfs situations.
530
531=head2 nss_delete core dump from op/pwent or op/grent
532
533See L<perlhpux/"nss_delete core dump from op/pwent or op/grent">.
534
535=head1 CROSS-COMPILATION
536
537Nothing too unusual here.  You can easily do this if you have a
538cross-compiler available;  A usual Configure invocation when targetting a
539Solaris x86 looks something like this:
540
541    sh ./Configure -des -Dusecrosscompile \
542        -Dcc=i386-pc-solaris2.11-gcc      \
543        -Dsysroot=$SYSROOT                \
544        -Alddlflags=" -Wl,-z,notext"      \
545        -Dtargethost=... # The usual cross-compilation options
546
547The lddlflags addition is the only abnormal bit.
548
549=head1 PREBUILT BINARIES OF PERL FOR SOLARIS.
550
551You can pick up prebuilt binaries for Solaris from
552L<http://www.sunfreeware.com/>, L<http://www.blastwave.org>,
553ActiveState L<http://www.activestate.com/>, and
554L<http://www.perl.com/> under the Binaries list at the top of the
555page.  There are probably other sources as well.  Please note that
556these sites are under the control of their respective owners, not the
557perl developers.
558
559=head1 RUNTIME ISSUES FOR PERL ON SOLARIS.
560
561=head2 Limits on Numbers of Open Files on Solaris.
562
563The stdio(3C) manpage notes that for LP32 applications, only 255
564files may be opened using fopen(), and only file descriptors 0
565through 255 can be used in a stream.  Since perl calls open() and
566then fdopen(3C) with the resulting file descriptor, perl is limited
567to 255 simultaneous open files, even if sysopen() is used.  If this
568proves to be an insurmountable problem, you can compile perl as a
569LP64 application, see L</Building an LP64 perl> for details.  Note
570also that the default resource limit for open file descriptors on
571Solaris is 255, so you will have to modify your ulimit or rctl
572(Solaris 9 onwards) appropriately.
573
574=head1 SOLARIS-SPECIFIC MODULES.
575
576See the modules under the Solaris:: and Sun::Solaris namespaces on CPAN,
577see L<http://www.cpan.org/modules/by-module/Solaris/> and
578L<http://www.cpan.org/modules/by-module/Sun/>.
579
580=head1 SOLARIS-SPECIFIC PROBLEMS WITH MODULES.
581
582=head2 Proc::ProcessTable on Solaris
583
584Proc::ProcessTable does not compile on Solaris with perl5.6.0 and higher
585if you have LARGEFILES defined.  Since largefile support is the
586default in 5.6.0 and later, you have to take special steps to use this
587module.
588
589The problem is that various structures visible via procfs use off_t,
590and if you compile with largefile support these change from 32 bits to
59164 bits.  Thus what you get back from procfs doesn't match up with
592the structures in perl, resulting in garbage.  See proc(4) for further
593discussion.
594
595A fix for Proc::ProcessTable is to edit Makefile to
596explicitly remove the largefile flags from the ones MakeMaker picks up
597from Config.pm.  This will result in Proc::ProcessTable being built
598under the correct environment.  Everything should then be OK as long as
599Proc::ProcessTable doesn't try to share off_t's with the rest of perl,
600or if it does they should be explicitly specified as off64_t.
601
602=head2 BSD::Resource on Solaris
603
604BSD::Resource versions earlier than 1.09 do not compile on Solaris
605with perl 5.6.0 and higher, for the same reasons as Proc::ProcessTable.
606BSD::Resource versions starting from 1.09 have a workaround for the problem.
607
608=head2 Net::SSLeay on Solaris
609
610Net::SSLeay requires a /dev/urandom to be present. This device is
611available from Solaris 9 onwards.  For earlier Solaris versions you
612can either get the package SUNWski (packaged with several Sun
613software products, for example the Sun WebServer, which is part of
614the Solaris Server Intranet Extension, or the Sun Directory Services,
615part of Solaris for ISPs) or download the ANDIrand package from
616L<http://www.cosy.sbg.ac.at/~andi/>. If you use SUNWski, make a
617symbolic link /dev/urandom pointing to /dev/random.  For more details,
618see Document ID27606 entitled "Differing /dev/random support requirements
619within Solaris[TM] Operating Environments", available at
620L<http://sunsolve.sun.com> .
621
622It may be possible to use the Entropy Gathering Daemon (written in
623Perl!), available from L<http://www.lothar.com/tech/crypto/>.
624
625=head1 SunOS 4.x
626
627In SunOS 4.x you most probably want to use the SunOS ld, /usr/bin/ld,
628since the more recent versions of GNU ld (like 2.13) do not seem to
629work for building Perl anymore.  When linking the extensions, the
630GNU ld gets very unhappy and spews a lot of errors like this
631
632  ... relocation truncated to fit: BASE13 ...
633
634and dies.  Therefore the SunOS 4.1 hints file explicitly sets the
635ld to be F</usr/bin/ld>.
636
637As of Perl 5.8.1 the dynamic loading of libraries (DynaLoader, XSLoader)
638also seems to have become broken in in SunOS 4.x.  Therefore the default
639is to build Perl statically.
640
641Running the test suite in SunOS 4.1 is a bit tricky since the
642F<dist/Tie-File/t/09_gen_rs.t> test hangs (subtest #51, FWIW) for some
643unknown reason.  Just stop the test and kill that particular Perl
644process.
645
646There are various other failures, that as of SunOS 4.1.4 and gcc 3.2.2
647look a lot like gcc bugs.  Many of the failures happen in the Encode
648tests, where for example when the test expects "0" you get "&#48;"
649which should after a little squinting look very odd indeed.
650Another example is earlier in F<t/run/fresh_perl> where chr(0xff) is
651expected but the test fails because the result is chr(0xff).  Exactly.
652
653This is the "make test" result from the said combination:
654
655  Failed 27 test scripts out of 745, 96.38% okay.
656
657Running the C<harness> is painful because of the many failing
658Unicode-related tests will output megabytes of failure messages,
659but if one patiently waits, one gets these results:
660
661 Failed Test                     Stat Wstat Total Fail  Failed  List of Failed
662 -----------------------------------------------------------------------------
663 ...
664 ../ext/Encode/t/at-cn.t            4  1024    29    4  13.79%  14-17
665 ../ext/Encode/t/at-tw.t           10  2560    17   10  58.82%  2 4 6 8 10 12
666                                                                14-17
667 ../ext/Encode/t/enc_data.t        29  7424    ??   ??       %  ??
668 ../ext/Encode/t/enc_eucjp.t       29  7424    ??   ??       %  ??
669 ../ext/Encode/t/enc_module.t      29  7424    ??   ??       %  ??
670 ../ext/Encode/t/encoding.t        29  7424    ??   ??       %  ??
671 ../ext/Encode/t/grow.t            12  3072    24   12  50.00%  2 4 6 8 10 12 14
672                                                                16 18 20 22 24
673  Failed Test                     Stat Wstat Total Fail  Failed  List of Failed
674 ------------------------------------------------------------------------------
675 ../ext/Encode/t/guess.t          255 65280    29   40 137.93%  10-29
676 ../ext/Encode/t/jperl.t           29  7424    15   30 200.00%  1-15
677 ../ext/Encode/t/mime-header.t      2   512    10    2  20.00%  2-3
678 ../ext/Encode/t/perlio.t          22  5632    38   22  57.89%  1-4 9-16 19-20
679                                                                23-24 27-32
680 ../ext/List/Util/t/shuffle.t       0   139    ??   ??       %  ??
681 ../ext/PerlIO/t/encoding.t                    14    1   7.14%  11
682 ../ext/PerlIO/t/fallback.t                     9    2  22.22%  3 5
683 ../ext/Socket/t/socketpair.t       0     2    45   70 155.56%  11-45
684 ../lib/CPAN/t/vcmp.t                          30    1   3.33%  25
685 ../lib/Tie/File/t/09_gen_rs.t      0    15    ??   ??       %  ??
686 ../lib/Unicode/Collate/t/test.t              199   30  15.08%  7 26-27 71-75
687                                                                81-88 95 101
688                                                                103-104 106 108-
689                                                                109 122 124 161
690                                                                169-172
691 ../lib/sort.t                      0   139   119   26  21.85%  107-119
692 op/alarm.t                                     4    1  25.00%  4
693 op/utfhash.t                                  97    1   1.03%  31
694 run/fresh_perl.t                              91    1   1.10%  32
695 uni/tr_7jis.t                                 ??   ??       %  ??
696 uni/tr_eucjp.t                    29  7424     6   12 200.00%  1-6
697 uni/tr_sjis.t                     29  7424     6   12 200.00%  1-6
698 56 tests and 467 subtests skipped.
699 Failed 27/811 test scripts, 96.67% okay. 1383/75399 subtests failed,
700   98.17% okay.
701
702The alarm() test failure is caused by system() apparently blocking
703alarm().  That is probably a libc bug, and given that SunOS 4.x
704has been end-of-lifed years ago, don't hold your breath for a fix.
705In addition to that, don't try anything too Unicode-y, especially
706with Encode, and you should be fine in SunOS 4.x.
707
708=head1 AUTHOR
709
710The original was written by Andy Dougherty F<doughera@lafayette.edu>
711drawing heavily on advice from Alan Burlison, Nick Ing-Simmons, Tim Bunce,
712and many other Solaris users over the years.
713
714Please report any errors, updates, or suggestions to
715L<https://github.com/Perl/perl5/issues>.
716

README.synology

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is. But if you have been into Perl you
6probably already know this.
7
8=head1 NAME
9
10perlsynology - Perl 5 on Synology DSM systems
11
12=head1 DESCRIPTION
13
14Synology manufactures a vast number of Network Attached Storage (NAS)
15devices that are very popular in large organisations as well as small
16businesses and homes.
17
18The NAS systems are equipped with Synology Disk Storage Manager (DSM),
19which is a trimmed-down Linux system enhanced with several tools for
20managing the NAS. There are several flavours of hardware: Marvell
21Armada (ARMv5tel, ARMv7l), Intel Atom (i686, x86_64), Freescale QorIQ
22(PPC), and more. For a full list see the
23L<Synology FAQ|https://kb.synology.com/en-global/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have>.
24
25Since it is based on Linux, the NAS can run many popular Linux
26software packages, including Perl. In fact, Synology provides a
27ready-to-install package for Perl, depending on the version of DSM
28the installed perl ranges from 5.8.6 on DSM-4.3 to 5.28.1 on DSM-7.1.
29
30There is an active user community that provides many software packages
31for the Synology DSM systems; at the time of writing this document
32they provide Perl version 5.28.1.
33
34This document describes various features of Synology DSM operating
35system that will affect how Perl 5 (hereafter just Perl) is
36configured, compiled and/or runs. It has been compiled and verified by
37Johan Vromans for the Synology DS413 (QorIQ), with feedback from
38H.Merijn Brand (DS213: ARMv5tel, RS815: Intel Atom x64, and DS218+:
39Celeron J3355).
40
41=head2 Setting up the build environment
42
43=head3 DSM 7
44
45For a comfortable development environment, Entware is currently the only
46viable solution. Just follow the detailed instructions on
47L<Install Entware on Synology NAS|https://github.com/Entware/Entware/wiki/Install-on-Synology-NAS>.
48supported architectures are armv5, armv7, mipsel, wl500g, x86_32, and x86_64.
49Check L<here|https://pkg.entware.net/binaries/> for supported platforms.
50
51That github link also shows what environments should be supported.
52
53It was tested on DSM-7.1 by H.Merijn Brand on a DS218+ and a DS220+ (both
54Intel x64).
55
56Entware comes with a precompiled 5.26.1 (Jan 2018) that allowes
57building shared XS code. Note that this installation does B<not> use
58a site_perl folder. The available C<cpan> works. If all required
59development packages are installed too, also for XS.
60
61Installing perl from the Community package center:
62
63=over 4
64
65=item *
66
67Using your favourite browser open the DSM management page and start
68the Package Center.
69
70=item *
71
72In Settings, add the following Package Sources:
73
74  Name:     Community
75  Location: https://synopackage.com/repository/spk/All
76
77=item *
78
79Still in Settings, in Channel Update, select Beta Channel.
80
81=back
82
83To complete the development environment, install make and gcc
84
85 ds220# opkg install make gcc
86
87Then, optionally, make sure you use the more recent bash and gawk.
88
89 ds220# opkg install bash gawk
90 ds220# cd /usr/bin
91 ds220# mv bash bash.syno
92 ds220# ln -s /opt/bin/bash .
93
94In order to have Configure find the required libraries
95
96 ds220# cd /opt/lib
97 ds220# ln -s libcrypt.so.?       libcrypt.so
98 ds220# ln -s libdl.so.?          libdl.so
99 ds220# ln -s libgdbm.so.?        libgdbm.so
100 ds220# ln -s libgdbm_compat.so.? libgdbm_compat.so
101 ds220# ln -s libm.so.?           libm.so
102 ds220# ln -s libpthread.so.?     libpthread.so
103 ds220# ln -s libutil.so.?        libutil.so
104
105=head3 DSM 6
106
107Using iPkg has been deprecated on DSM 6, but an alternative is available
108for DSM 6: entware/opkg. For instructions on how to use that, please read
109L<Install Entware-ng on Synology NAS|https://github.com/Entware-ng/Entware-ng/wiki/Install-on-Synology-NAS>
110
111That sadly does not (yet) work on QorIQ. At the moment of writing, the
112supported architectures are armv5, armv7, mipsel, wl500g, x86_32, and x86_64.
113Check L<here|https://pkg.entware.net/binaries/> for supported platforms.
114
115Entware-ng comes with a precompiled 5.24.1 (June 2017) that allowes
116building shared XS code. Note that this installation does B<not> use
117a site_perl folder. The available C<cpan> works. If all required
118development packages are installed too, also for XS.
119
120=head3 DSM 5
121
122As DSM is a trimmed-down Linux system, it lacks many of the tools and
123libraries commonly found on Linux. The basic tools like sh, cp, rm,
124etc. are implemented using
125L<BusyBox|https://en.wikipedia.org/wiki/BusyBox>.
126
127=over 4
128
129=item *
130
131Using your favourite browser open the DSM management page and start
132the Package Center.
133
134=item *
135
136If you want to smoke test Perl, install C<Perl>.
137
138=item *
139
140In Settings, add the following Package Sources:
141
142  https://www.cphub.net
143  http://packages.quadrat4.de
144
145As these two are both discontinued, it is unlikely you will be able
146to set up a build environment on DSM 5.
147
148=item *
149
150Still in Settings, in Channel Update, select Beta Channel.
151
152=item *
153
154Press Refresh. In the left panel the item "Community" will appear.
155Click it. Select "Bootstrap Installer Beta" and install it.
156
157=item *
158
159Likewise, install "iPKGui Beta".
160
161The application window should now show an icon for iPKGui.
162
163=item *
164
165Start iPKGui. Install the packages C<make>, C<gcc> and C<coreutils>.
166
167If you want to smoke test Perl, install C<patch>.
168
169=back
170
171The next step is to add some symlinks to system libraries. For
172example, the development software expect a library C<libm.so> that
173normally is a symlink to C<libm.so.6>. Synology only provides the
174latter and not the symlink.
175
176Here the actual architecture of the Synology system matters. You have
177to find out where the gcc libraries have been installed. Look in /opt
178for a directory similar to arm-none-linux-gnueab or
179powerpc-linux-gnuspe. In the instructions below I'll use
180powerpc-linux-gnuspe as an example.
181
182=over 4
183
184=item *
185
186On the DSM management page start the Control Panel.
187
188=item *
189
190Click Terminal, and enable SSH service.
191
192=item *
193
194Close Terminal and the Control Panel.
195
196=item *
197
198Open a shell on the Synology using ssh and become root.
199
200=item *
201
202Execute the following commands:
203
204  cd /lib
205  ln -s libm.so.6 libm.so
206  ln -s libcrypt.so.1 libcrypt.so
207  ln -s libdl.so.2 libdl.so
208  cd /opt/powerpc-linux-gnuspe/lib  (or
209                                    /opt/arm-none-linux-gnueabi/lib)
210  ln -s /lib/libdl.so.2 libdl.so
211
212=back
213
214B<WARNING:> When you perform a system software upgrade, these links
215will disappear and need to be re-established.
216
217=head2 Compiling Perl 5
218
219When the build environment has been set up, building and testing Perl
220is straightforward. The only thing you need to do is download the
221sources as usual, and add a file Policy.sh as follows:
222
223  # Administrivia.
224  perladmin="your.email@goes.here"
225
226  # Install Perl in a tree in /opt/perl instead of /opt/bin.
227  prefix=/opt/perl
228
229  # Select the compiler. Note that there is no 'cc' alias or link
230  # on older DSM versions
231  cc=gcc
232  awk=/opt/bin/gawk
233
234  # Build flags. Optional
235  ccflags="-DDEBUGGING"
236
237  # Library and include paths.
238  locincpth="/opt/include"
239  loclibpth="/opt/lib /usr/local/lib /usr/lib"
240  libpth="/opt/lib /usr/local/lib /usr/lib"
241
242You may want to create the destination directory and give it the right
243permissions before installing, thus eliminating the need to build Perl
244as a super user.
245
246In the directory where you unpacked the sources, issue the familiar
247commands:
248
249  $ bash ./Configure -Dusedevel -Duseshrplib -Duse64bitall -des
250  $ make -j2
251  $ env TEST_JOBS=2 make test_harness
252  $ make install
253
254=head2 Known problems
255
256=head3 Configure
257
258The GNU C-compiler might spit out unexpected stuff under -v, which
259causes the analysis of cppsymbols to fail because of unmatched quotes.
260
261You'll note if config.sh fails with a syntax error.
262
263=head3 Build
264
265=over 4
266
267=item Error message "No error definitions found".
268
269This error is generated when it is not possible to find the local
270definitions for error codes, due to the uncommon structure of the
271Synology file system.
272
273This error was fixed in the Perl development git for version 5.19,
274commit 7a8f1212e5482613c8a5b0402528e3105b26ff24.
275
276=back
277
278=head3 Failing tests
279
280=over 4
281
282=item F<ext/DynaLoader/t/DynaLoader.t>
283
284One subtest fails due to the uncommon structure of the Synology file
285system. The file F</lib/glibc.so> is missing.
286
287B<WARNING:> Do not symlink F</lib/glibc.so.6> to F</lib/glibc.so> or
288some system components will start to fail.
289
290=back
291
292=head2 Smoke testing Perl
293
294If building completes successfully, you can set up smoke testing as
295described in the Test::Smoke documentation.
296
297For smoke testing you need a running Perl. You can either install the
298Synology supplied package for Perl 5.8.6, or build and install your
299own, much more recent version.
300
301Note that I could not run successful smokes when initiated by the
302Synology Task Scheduler. I resorted to initiating the smokes via a
303cron job run on another system, using ssh:
304
305  ssh nas1 wrk/Test-Smoke/smoke/smokecurrent.sh
306
307=head3 Local patches
308
309When local patches are applied with smoke testing, the test driver
310will automatically request regeneration of certain tables after the
311patches are applied. The Synology supplied Perl 5.8.6 (at least on the
312DS413) B<is NOT capable> of generating these tables. It will generate
313opcodes with bogus values, causing the build to fail.
314
315You can prevent regeneration by adding the setting
316
317  'flags' => 0,
318
319to the smoke config, or by adding another patch that inserts
320
321  exit 0 if $] == 5.008006;
322
323in the beginning of the C<regen.pl> program.
324
325=head2 Adding libraries
326
327The above procedure describes a basic environment and hence results in
328a basic Perl. If you want to add additional libraries to Perl, you may
329need some extra settings.
330
331For example, the basic Perl does not have any of the DB libraries (db,
332dbm, ndbm, gdsm). You can add these using iPKGui, however, you need to
333set environment variable LD_LIBRARY_PATH to the appropriate value:
334
335  LD_LIBRARY_PATH=/lib:/opt/lib
336  export LD_LIBRARY_PATH
337
338This setting needs to be in effect while Perl is built, but also when
339the programs are run.
340
341=head1 REVISION
342
343July 2022, for DSM 5.1.5022 and DSM 6.1-15101-4, and DSM-7.1-42661-3.
344
345=head1 AUTHOR
346
347Johan Vromans <jvromans@squirrel.nl>
348H. Merijn Brand <cpan@tux.freedom.nl>
349
350=cut
351

README.tru64

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you see.
4It is written in the POD format (see pod/perlpod.pod) which is specially
5designed to be readable as is.
6
7=head1 NAME
8
9perltru64 - Perl version 5 on Tru64 (formerly known as Digital UNIX formerly known as DEC OSF/1) systems
10
11=head1 DESCRIPTION
12
13This document describes various features of HP's (formerly Compaq's,
14formerly Digital's) Unix operating system (Tru64) that will affect
15how Perl version 5 (hereafter just Perl) is configured, compiled
16and/or runs.
17
18=head2 Compiling Perl 5 on Tru64
19
20The recommended compiler to use in Tru64 is the native C compiler.
21The native compiler produces much faster code (the speed difference is
22noticeable: several dozen percentages) and also more correct code: if
23you are considering using the GNU C compiler you should use at the
24very least the release of 2.95.3 since all older gcc releases are
25known to produce broken code when compiling Perl.  One manifestation
26of this brokenness is the lib/sdbm test dumping core; another is many
27of the op/regexp and op/pat, or ext/Storable tests dumping core
28(the exact pattern of failures depending on the GCC release and
29optimization flags).
30
31Both the native cc and gcc seem to consume lots of memory when
32building Perl.  toke.c is a known trouble spot when optimizing:
33256 megabytes of data section seems to be enough.  Another known
34trouble spot is the mktables script which builds the Unicode support
35tables.  The default setting of the process data section in Tru64
36should be one gigabyte, but some sites/setups might have lowered that.
37The configuration process of Perl checks for too low process limits,
38and lowers the optimization for the toke.c if necessary, and also
39gives advice on how to raise the process limits
40(for example: C<ulimit -d 262144>)
41
42Also, Configure might abort with
43
44 Build a threading Perl? [n]
45 Configure[2437]: Syntax error at line 1 : 'config.sh' is not expected.
46
47This indicates that Configure is being run with a broken Korn shell
48(even though you think you are using a Bourne shell by using
49"sh Configure" or "./Configure").  The Korn shell bug has been reported
50to Compaq as of February 1999 but in the meanwhile, the reason ksh is
51being used is that you have the environment variable BIN_SH set to
52'xpg4'.  This causes /bin/sh to delegate its duties to /bin/posix/sh
53(a ksh).  Unset the environment variable and rerun Configure.
54
55=head2 Using Large Files with Perl on Tru64
56
57In Tru64 Perl is automatically able to use large files, that is,
58files larger than 2 gigabytes, there is no need to use the Configure
59-Duselargefiles option as described in INSTALL (though using the option
60is harmless).
61
62=head2 Threaded Perl on Tru64
63
64If you want to use threads, you should primarily use the Perl
655.8.0 threads model by running Configure with -Duseithreads.
66
67Perl threading is going to work only in Tru64 4.0 and newer releases,
68older operating releases like 3.2 aren't probably going to work
69properly with threads.
70
71In Tru64 V5 (at least V5.1A, V5.1B) you cannot build threaded Perl with gcc
72because the system header <pthread.h> explicitly checks for supported
73C compilers, gcc (at least 3.2.2) not being one of them.  But the
74system C compiler should work just fine.
75
76=head2 Long Doubles on Tru64
77
78You cannot Configure Perl to use long doubles unless you have at least
79Tru64 V5.0, the long double support simply wasn't functional enough
80before that.  Perl's Configure will override attempts to use the long
81doubles (you can notice this by Configure finding out that the modfl()
82function does not work as it should).
83
84At the time of this writing (June 2002), there is a known bug in the
85Tru64 libc printing of long doubles when not using "e" notation.
86The values are correct and usable, but you only get a limited number
87of digits displayed unless you force the issue by using C<printf
88"%.33e",$num> or the like.  For Tru64 versions V5.0A through V5.1A, a
89patch is expected sometime after perl 5.8.0 is released.  If your libc
90has not yet been patched, you'll get a warning from Configure when
91selecting long doubles.
92
93=head2 DB_File tests failing on Tru64
94
95The DB_File tests (db-btree.t, db-hash.t, db-recno.t) may fail you
96have installed a newer version of Berkeley DB into the system and the
97-I and -L compiler and linker flags introduce version conflicts with
98the DB 1.85 headers and libraries that came with the Tru64.  For example,
99mixing a DB v2 library with the DB v1 headers is a bad idea.  Watch
100out for Configure options -Dlocincpth and -Dloclibpth, and check your
101/usr/local/include and /usr/local/lib since they are included by default.
102
103The second option is to explicitly instruct Configure to detect the
104newer Berkeley DB installation, by supplying the right directories with
105C<-Dlocincpth=/some/include> and C<-Dloclibpth=/some/lib> B<and> before
106running "make test" setting your LD_LIBRARY_PATH to F</some/lib>.
107
108The third option is to work around the problem by disabling the
109DB_File completely when build Perl by specifying -Ui_db to Configure,
110and then using the BerkeleyDB module from CPAN instead of DB_File.
111The BerkeleyDB works with Berkeley DB versions 2.* or greater.
112
113The Berkeley DB 4.1.25 has been tested with Tru64 V5.1A and found
114to work.  The latest Berkeley DB can be found from L<http://www.sleepycat.com>.
115
116=head2 64-bit Perl on Tru64
117
118In Tru64 Perl's integers are automatically 64-bit wide, there is
119no need to use the Configure -Duse64bitint option as described
120in INSTALL.  Similarly, there is no need for -Duse64bitall
121since pointers are automatically 64-bit wide.
122
123=head2 Warnings about floating-point overflow when compiling Perl on Tru64
124
125When compiling Perl in Tru64 you may (depending on the compiler
126release) see two warnings like this
127
128 cc: Warning: numeric.c, line 104: In this statement, floating-point
129 overflow occurs in evaluating the expression "1.8e308". (floatoverfl)
130     return HUGE_VAL;
131 -----------^
132
133and when compiling the POSIX extension
134
135 cc: Warning: const-c.inc, line 2007: In this statement, floating-point
136 overflow occurs in evaluating the expression "1.8e308". (floatoverfl)
137             return HUGE_VAL;
138 -------------------^
139
140The exact line numbers may vary between Perl releases.  The warnings
141are benign and can be ignored: in later C compiler releases the warnings
142should be gone.
143
144When the file F<pp_sys.c> is being compiled you may (depending on the
145operating system release) see an additional compiler flag being used:
146C<-DNO_EFF_ONLY_OK>.  This is normal and refers to a feature that is
147relevant only if you use the C<filetest> pragma.  In older releases of
148the operating system the feature was broken and the NO_EFF_ONLY_OK
149instructs Perl not to use the feature.
150
151=head1 Testing Perl on Tru64
152
153During "make test" the C<comp>/C<cpp> will be skipped because on Tru64 it
154cannot be tested before Perl has been installed.  The test refers to
155the use of the C<-P> option of Perl.
156
157=head1 ext/ODBM_File/odbm Test Failing With Static Builds
158
159The ext/ODBM_File/odbm is known to fail with static builds
160(Configure -Uusedl) due to a known bug in Tru64's static libdbm
161library.  The good news is that you very probably don't need to ever
162use the ODBM_File extension since more advanced NDBM_File works fine,
163not to mention the even more advanced DB_File.
164
165=head1 Perl Fails Because Of Unresolved Symbol sockatmark
166
167If you get an error like
168
169    Can't load '.../OSF1/lib/perl5/5.8.0/alpha-dec_osf/auto/IO/IO.so' for module IO: Unresolved symbol in .../lib/perl5/5.8.0/alpha-dec_osf/auto/IO/IO.so: sockatmark at .../lib/perl5/5.8.0/alpha-dec_osf/XSLoader.pm line 75.
170
171you need to either recompile your Perl in Tru64 4.0D or upgrade your
172Tru64 4.0D to at least 4.0F: the sockatmark() system call was
173added in Tru64 4.0F, and the IO extension refers that symbol.
174
175=head1 read_cur_obj_info: bad file magic number
176
177You may be mixing the Tru64 cc/ar/ld with the GNU gcc/ar/ld.
178That may work, but sometimes it doesn't (your gcc or GNU utils
179may have been compiled for an incompatible OS release).
180
181Try 'which ld' and 'which ld' (or try 'ar --version' and 'ld --version',
182which work only for the GNU tools, and will announce themselves to be such),
183and adjust your PATH so that you are consistently using either
184the native tools or the GNU tools.  After fixing your PATH, you should
185do 'make distclean' and start all the way from running the Configure
186since you may have quite a confused situation.
187
188=head1 AUTHOR
189
190Jarkko Hietaniemi <jhi@iki.fi>
191
192=cut
193

README.tw

1# vim: syntax=pod
2
3如果你用一般的文字編輯器閱覽這份文件, 請忽略文中奇特的註記字符.
4這份文件是以 POD (簡明文件格式) 寫成; 這種格式是為了能讓人直接讀取,
5而特別設計的. 關於此格式的進一步資訊, 請參考 perlpod 線上文件.
6
7=encoding utf8
8
9=head1 NAME
10
11perltw - 正體中文 Perl 指南
12
13=head1 DESCRIPTION
14
15歡迎來到 Perl 的天地!
16
17從 5.8.0 版開始, Perl 具備了完善的 Unicode (萬國碼) 支援,
18也連帶支援了許多拉丁語系以外的編碼方式; CJK (中日韓) 便是其中的一部份.
19Unicode 是國際性的標準, 試圖涵蓋世界上所有的字符: 西方世界, 東方世界,
20以及兩者間的一切 (希臘文, 敘利亞文, 阿拉伯文, 希伯來文, 印度文,
21印地安文, 等等). 它也容納了多種作業系統與平臺 (如 PC 及麥金塔).
22
23Perl 本身以 Unicode 進行操作. 這表示 Perl 內部的字串資料可用 Unicode
24表示; Perl 的函式與算符 (例如正規表示式比對) 也能對 Unicode 進行操作.
25在輸入及輸出時, 為了處理以 Unicode 之前的編碼方式儲存的資料, Perl
26提供了 Encode 這個模組, 可以讓你輕易地讀取及寫入舊有的編碼資料.
27
28Encode 延伸模組支援下列正體中文的編碼方式 ('big5' 表示 'big5-eten'):
29
30    big5-eten	Big5 編碼 (含倚天延伸字形)
31    big5-hkscs	Big5 + 香港外字集, 2001 年版
32    cp950	字碼頁 950 (Big5 + 微軟添加的字符)
33
34舉例來說, 將 Big5 編碼的檔案轉成 Unicode, 祗需鍵入下列指令:
35
36    perl -MEncode -pe '$_= encode( utf8 => decode( big5 => $_ ) )' \
37      < file.big5 > file.utf8
38
39Perl 也內附了 "piconv", 一支完全以 Perl 寫成的字符轉換工具程式, 用法如下:
40
41    piconv -f big5 -t utf8 < file.big5 > file.utf8
42    piconv -f utf8 -t big5 < file.utf8 > file.big5
43
44另外,若程式碼本身以 utf8 編碼儲存,配合使用 utf8 模組,可讓程式碼中字串以及其運
45算皆以字符為單位,而不以位元為單位,如下所示:
46
47    #!/usr/bin/env perl
48    use utf8;
49    print length("駱駝");	     #  2 (不是 6)
50    print index("諄諄教誨", "教誨"); #  2 (從 0 起算第 2 個字符)
51
52
53=head2 額外的中文編碼
54
55如果需要更多的中文編碼, 可以從 CPAN (L<https://www.cpan.org/>) 下載
56Encode::HanExtra 模組. 它目前提供下列編碼方式:
57
58    cccii	1980 年文建會的中文資訊交換碼
59    euc-tw	Unix 延伸字符集, 包含 CNS11643 平面 1-7
60    big5plus	中文數位化技術推廣基金會的 Big5+
61    big5ext	中文數位化技術推廣基金會的 Big5e
62
63另外, Encode::HanConvert 模組則提供了簡繁轉換用的兩種編碼:
64
65    big5-simp	Big5 正體中文與 Unicode 簡體中文互轉
66    gbk-trad	GBK 簡體中文與 Unicode 正體中文互轉
67
68若想在 GBK 與 Big5 之間互轉, 請參考該模組內附的 b2g.plg2b.pl 兩支程式,
69或在程式內使用下列寫法:
70
71    use Encode::HanConvert;
72    $euc_cn = big5_to_gb($big5); # 從 Big5 轉為 GBK
73    $big5 = gb_to_big5($euc_cn); # 從 GBK 轉為 Big5
74
75=head2 進一步的資訊
76
77請參考 Perl 內附的大量說明文件 (不幸全是用英文寫的), 來學習更多關於
78Perl 的知識, 以及 Unicode 的使用方式. 不過, 外部的資源相當豐富:
79
80=head2 提供 Perl 資源的網址
81
82=over 4
83
84=item L<https://www.perl.org/>
85
86Perl 的首頁
87
88=item L<https://www.perl.com/>
89
90由 Perl 基金會所營運的文章輯錄
91
92=item L<https://www.cpan.org/>
93
94Perl 綜合典藏網 (Comprehensive Perl Archive Network)
95
96=item L<https://lists.perl.org/>
97
98Perl 郵遞論壇一覽
99
100=back
101
102=head2 學習 Perl 的網址
103
104=over 4
105
106=item L<http://www.oreilly.com.cn/index.php?func=booklist&cat=68>
107
108正體中文版的歐萊禮 Perl 書藉
109
110=back
111
112=head2 Perl 使用者集會
113
114=over 4
115
116=item L<https://www.pm.org/groups/taiwan.html>
117
118臺灣 Perl 推廣組一覽
119
120=item L<irc://chat.freenode.org/#perl.tw>
121
122Perl.tw 線上聊天室
123
124=back
125
126=head2 Unicode 相關網址
127
128=over 4
129
130=item L<https://www.unicode.org/>
131
132Unicode 學術學會 (Unicode 標準的制定者)
133
134=item L<http://www.cl.cam.ac.uk/%7Emgk25/unicode.html>
135
136Unix/Linux 上的 UTF-8 及 Unicode 答客問
137
138=back
139
140=head2 中文化資訊
141
142=over 4
143
144=item 中文化軟體聯盟
145
146L<http://www.cpatch.org/>
147
148=back
149
150=head1 SEE ALSO
151
152L<Encode>, L<Encode::TW>, L<perluniintro>, L<perlunicode>
153
154=head1 AUTHORS
155
156Jarkko Hietaniemi E<lt>jhi@iki.fiE<gt>
157
158Audrey Tang (唐鳳) E<lt>audreyt@audreyt.orgE<gt>
159
160=cut
161

README.vms

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the equal signs on the left.
4This file is written in the POD format (see [.pod]perlpod.pod) which is
5specially designed to be readable as is.
6
7=head1 NAME
8
9perlvms - Configuring, building, testing, and installing perl on VMS
10
11=head1 SYNOPSIS
12
13To configure, build, test, and install perl on VMS:
14
15    @configure
16    mmk
17    mmk test
18    mmk install
19
20=head1 DESCRIPTION
21
22=head2 Important safety tip
23
24For best results, make sure you read the "Configuring the Perl Build",
25"Building  Perl", and "Installing Perl" sections of this document before
26you build or install.  Also please note other changes in the current
27release by having a look at L<perldelta/VMS>.
28
29=head2 Introduction to Perl on VMS
30
31The VMS port of Perl is as functionally complete as any other Perl port
32(and as complete as the ports on some Unix systems). The Perl binaries
33provide all the Perl system calls that are either available under VMS or
34reasonably emulated. There are some incompatibilities in process handling
35(e.g. the fork/exec model for creating subprocesses doesn't do what you
36might expect under Unix), mainly because VMS and Unix handle processes and
37sub-processes very differently.
38
39There are still some unimplemented system functions, and of course we
40could use modules implementing useful VMS system services, so if you'd like
41to lend a hand we'd love to have you.  Join the Perl Porting Team Now!
42
43=head2 Other required software for Compiling Perl on VMS
44
45In addition to VMS and DCL you will need three things:
46
47=over 4
48
49=item 1  A C compiler.
50
51VSI (formerly DEC/Compaq/HP/HPE) C for VMS (Alpha or Itanium). Various
52ancient versions of DEC C had some caveats, so if you're using a version
53older than 7.x, you may need to upgrade to get a successful build.
54
55There have been no recent reports of builds using Gnu C, but latent
56(and most likely outdated) support for it is still present in various
57parts of the sources.
58
59There is rudimentary but not quite complete support for HP C++; to try it out,
60configure with C<-"Dusecxx" -"Duser_c_flags=/WARN=INFORMATIONAL=NOCTOBUTCONREFM">.
61
62=item 2  A make tool.
63
64You will need the free MMS analog MMK (available from
65L<http://ftp.endlesssoftware.com.au/mmk/kits/> or
66L<https://github.com/endlesssoftware/mmk>). HP's MMS has not been known to work for
67some time as Perl's automatically-generated description files are too complex for it,
68but MMS support may return in the future.  Gnu Make might work, but it's been so long
69since anyone's tested it that we're not sure.
70
71=item 3  ODS-5 and Extended Parse
72
73All development and testing of Perl on VMS takes place on ODS-5 volumes with
74extended parse enabled in the environment via the command C<SET PROCESS/PARSE=EXTENDED>.
75Latent support for ODS-2 volumes is still present, but there have been some reports
76that it no longer works, and even if it builds, there will be many test failures,
77mostly related to the failure to preserve filename case. ODS-2 support may be
78explicity disabled in a future release.
79
80=back
81
82=head2 Additional software that is optional for Perl on VMS
83
84You may also want to have on hand:
85
86=over 4
87
88=item 1  gunzip/gzip for VMS
89
90A de-compressor for *.gz and *.tgz files available from a number
91of web/ftp sites such as:
92
93    L<http://www.antinode.info/dec/sw/gzip.html>
94    L<http://vms.process.com/scripts/fileserv/fileserv.com?GZIP>
95
96=item 2  VMS tar
97
98For reading and writing Unix tape archives (*.tar files).  Vmstar is also
99available from a number of sites such as:
100
101    L<http://www.antinode.info/dec/sw/vmstar.html>
102    L<http://vms.process.com/scripts/fileserv/fileserv.com?VMSTAR>
103
104A port of GNU tar is also available as part of the GNV package:
105
106    L<http://h71000.www7.hp.com/opensource/gnv.html>
107
108=item 3  unzip for VMS
109
110A combination decompressor and archive reader/writer for *.zip files.
111Unzip is available from a number of web/ftp sites.
112
113    L<http://www.info-zip.org/UnZip.html>
114    L<http://www.hp.com/go/openvms/freeware/>
115    L<http://vms.process.com/fileserv-software.html>
116
117=item 5 GNU patch and diffutils for VMS
118
119Patches to Perl are usually distributed as GNU unified or contextual diffs.
120Such patches are created by the GNU diff program (part of the diffutils
121distribution) and applied with GNU patch.  VMS ports of these utilities are
122available here:
123
124    L<http://www.antinode.info/dec/sw/diffutils.html>
125    L<http://vms.pdv-systeme.de/users/martinv/gnupatch.zip>
126
127=back
128
129Please note that unzip and gunzip are not the same thing (they work with
130different formats).  Many of the useful files from CPAN (the Comprehensive
131Perl Archive Network) are in *.tar.gz or *.tgz format (this includes copies
132of the source code for perl as well as modules and scripts that you may
133wish to add later) hence you probably want to have GUNZIP.EXE and
134VMSTAR.EXE on your VMS machine.
135
136=head1 Unpacking the Perl source code
137
138You may need to set up a foreign symbol for the unpacking utility of
139choice.  Once you have done so, use a command like the following to
140unpack the archive:
141
142    vmstar -xvf perl-5^.38^.2.tar
143
144Then set default to the top-level source directory like so:
145
146    set default [.perl-5^.38^.2]
147
148and proceed with configuration as described in the next section.
149
150
151=head1 Configuring the Perl build
152
153To configure perl (a necessary first step), issue the command
154
155   @configure.com
156
157from the top of an unpacked perl source directory.  You will be asked a
158series of questions, and the answers to them (along with the capabilities
159of your C compiler and network stack) will determine how perl is custom-
160built for your machine.
161
162If you have any symbols or logical names in your environment that may
163interfere with the build or regression testing of perl then F<configure.com>
164will try to warn you about them.  If a logical name is causing
165you trouble but is in an LNM table that you do not have write access to
166then try defining your own to a harmless equivalence string in a table
167such that it is resolved before the other (e.g. if TMP is defined in the
168SYSTEM table then try DEFINE TMP "NL:" or somesuch in your process table)
169otherwise simply deassign the dangerous logical names.  The potentially
170troublesome logicals and symbols include:
171
172    COMP    "LOGICAL"
173    EXT     "LOGICAL"
174    FOO     "LOGICAL"
175    LIB     "LOGICAL"
176    LIST    "LOGICAL"
177    MIME    "LOGICAL"
178    POSIX   "LOGICAL"
179    SYS     "LOGICAL"
180    T       "LOGICAL"
181    THREAD  "LOGICAL"
182    THREADS "LOGICAL"
183    TIME    "LOGICAL"
184    TMP     "LOGICAL"
185    UNICODE "LOGICAL"
186    UTIL    "LOGICAL"
187    TEST    "SYMBOL"
188
189As a handy shortcut, the command:
190
191    @configure "-des"
192
193(note the quotation marks and case) will choose reasonable defaults
194automatically.  Some options can be given explicitly on the command line;
195the following example specifies a non-default location for where Perl
196will be installed:
197
198    @configure "-d" "-Dprefix=dka100:[utils.perl5.]"
199
200Note that the installation location would be by default where you unpacked
201the source with a "_ROOT." appended.  For example if you unpacked the perl
202source into:
203
204   F<DKA200:[PERL-5^.18^.0...]>
205
206Then the F<PERL_SETUP.COM> that gets written out by F<configure.com> will
207try to DEFINE your installation PERL_ROOT to be:
208
209   F<DKA200:[PERL-5^.18^.0_ROOT.]>
210
211More help with configure.com is available from:
212
213    @configure "-h"
214
215If you find yourself reconfiguring and rebuilding  then be sure to also follow
216the advice in the "Cleaning up and starting fresh (optional)" and the checklist
217of items in the "CAVEATS" sections below.
218
219=head2 Changing compile-time options (optional) for Perl on VMS
220
221Most of the user-definable features of Perl are enabled or disabled in
222configure.com, which processes the hints file config_h.SH.  There is
223code in there to Do The Right Thing, but that  may end up being the
224wrong thing for you.  Make sure you understand what you are doing since
225inappropriate changes to configure.com or config_h.SH can render perl
226unbuildable; odds are that there's nothing in there you'll need to
227change. Note also that non-default options are tested less than default
228options, so you may end up being more of a pioneer than you intend to be.
229
230=head1 Building Perl
231
232The configuration script will print out, at the very end, the MMS or MMK
233command you need to compile perl.  Issue it (exactly as printed) to start
234the build.
235
236Once you issue your MMS or MMK command, sit back and wait.  Perl should
237compile and link without a problem.  If a problem does occur check the
238"CAVEATS" section of this document.  If that does not help send some
239mail to the VMSPERL mailing list.  Instructions are in the L</"Mailing Lists">
240section of this document.
241
242=head1 Testing Perl
243
244Once Perl has built cleanly you need to test it to make sure things work.
245This step is very important since there are always things that can go wrong
246somehow and yield a dysfunctional Perl for you.
247
248Testing is very easy, though, as there's a full test suite in the perl
249distribution.  To run the tests, enter the I<exact> MMS line you used to
250compile Perl and add the word "test" to the end, like this:
251
252If the compile command was:
253
254    MMK
255
256then the test command ought to be:
257
258    MMK test
259
260MMK (or MMS) will run all the tests.  This may take some time, as there are
261a lot of tests.  If any tests fail, there will be a note made on-screen.
262At the end of all the tests, a summary of the tests, the number passed and
263failed, and the time taken will be displayed.
264
265The test driver invoked via MMK TEST has a DCL wrapper ([.VMS]TEST.COM) that
266downgrades privileges to NETMBX, TMPMBX for the duration of the test run,
267and then restores them to their prior state upon completion of testing.
268This is done to ensure that the tests run in a private sandbox and can do no
269harm to your system even in the unlikely event something goes badly wrong in
270one of the test scripts while running the tests from a privileged account.
271A side effect of this safety precaution is that the account used to run the
272test suite must be the owner of the directory tree in which Perl has been
273built; otherwise the manipulations of temporary files and directories
274attempted by some of the tests will fail.
275
276If any tests fail, it means something is wrong with Perl, or at least
277with the particular module or feature that reported failure. If the test suite
278hangs (some tests can take upwards of two or three minutes, or more if
279you're on an especially slow machine, depending on your machine speed, so
280don't be hasty), then the test I<after> the last one displayed failed. Don't
281install Perl unless you're confident that you're OK. Regardless of how
282confident you are, make a bug report to the VMSPerl mailing list.
283
284If one or more tests fail, you can get more information on the failure by
285issuing this command sequence:
286
287    @[.vms]test .typ "" "-v" [.subdir]test.t
288
289where ".typ" is the file type of the Perl images you just built (if you
290didn't do anything special, use .EXE), and "[.subdir]test.t" is the test
291that failed. For example, with a normal Perl build, if the test indicated
292that t/op/time failed, then you'd do this:
293
294    @ .vms]test .EXE "" "-v" [.op]time.t
295
296Note that test names are reported in UNIX syntax and relative to the
297top-level build directory.  When supplying them individually to the test
298driver, you must specify them in Unix format if they are outside of the [.t]
299directory; otherwise VMS syntax is ok. Note that you must also give the path
300relative to the [.t] directory and you must also add the .t extension to the
301filename.  So, for example if the test lib/warnings.t fails, you would run:
302
303    @[.vms]test .EXE "" -"v" "../lib/warnings.t"
304
305When you send in a bug report for failed tests, please include the output
306from this command, which is run from the main source directory:
307
308    MCR []MINIPERL "-Ilib" "-V"
309
310Note that -"V" really is a capital V in double quotes. This will dump out a
311couple of screens worth of configuration information, and can help us
312diagnose the problem.  If (and only if) that did not work then try enclosing
313the output of:
314
315    MMK printconfig
316
317If (and only if) that did not work then try enclosing the output of:
318
319    @[.vms]myconfig
320
321You may also be asked to provide your C compiler version ("CC/VERSION NL:"
322with DEC C, "gcc --version" with GNU CC).  To obtain the version of MMS or
323MMK you are running try "MMS/ident" or "MMK /ident".  The GNU make version
324can be identified with "make --version".
325
326=head2 Cleaning up and starting fresh (optional) installing Perl on VMS
327
328If you need to recompile from scratch, you have to make sure you clean up
329first.  There is a procedure to do it--enter the I<exact> MMK line you used
330to compile and add "realclean" at the end, like this:
331
332if the compile command was:
333
334    MMK
335
336then the cleanup command ought to be:
337
338    MMK realclean
339
340If you do not do this things may behave erratically during the subsequent
341rebuild attempt.  They might not, too, so it is best to be sure and do it.
342
343=head1 Installing Perl
344
345There are several steps you need to take to get Perl installed and
346running.
347
348=over 4
349
350=item 1
351
352Check your default file protections with
353
354     SHOW PROTECTION /DEFAULT
355
356and adjust if necessary with C<SET PROTECTION=(code)/DEFAULT>.
357
358=item 2
359
360Decide where you want Perl to be installed (unless you have already done so
361by using the "prefix" configuration parameter -- see the example in the
362"Configuring the Perl build" section).
363
364The DCL script PERL_SETUP.COM that is written by configure.com will help you
365with the definition of the PERL_ROOT and PERLSHR logical names and the PERL
366foreign command  symbol.  Take a look at PERL_SETUP.COM and modify it if you
367want to.  The installation process will execute PERL_SETUP.COM and copy
368files to the directory tree pointed to by the PERL_ROOT logical name defined
369there, so make sure that you have write access to the parent directory of
370what will become the root of your Perl installation.
371
372=item 3
373
374Run the install script via:
375
376    MMK install
377
378If for some reason it complains about target INSTALL being up to date,
379throw a /FORCE switch on the MMS or MMK command.
380
381=back
382
383Installation will copy F<PERL_SETUP.COM> to the root of your installation
384tree.  If you want to give everyone on the system  access to Perl (and you
385have, for example, installed to F<dsa0:[utils.perl_root]>) then add a line
386that reads:
387
388    $ @dsa0:[utils.perl_root]perl_setup
389
390to F<SYS$MANAGER:SYLOGIN.COM>.  Or for your own use only, simply place
391that line in F<SYS$LOGIN:LOGIN.COM>.
392
393Two alternatives to the foreign symbol would be to install PERL into
394DCLTABLES.EXE (Check out the section "Installing Perl into DCLTABLES
395(optional)" for more information), or put the image in a
396directory that's in your DCL$PATH.
397
398See also the "INSTALLing images (optional)" section.
399
400=head2 Installing Perl into DCLTABLES (optional) on VMS
401
402Execute the following command file to define PERL as a DCL command.
403You'll need CMKRNL privilege to install the new dcltables.exe.
404
405    $ create perl.cld
406    !
407    ! modify to reflect location of your perl.exe
408    !
409    define verb perl
410      image perl_root:[000000]perl.exe
411      cliflags (foreign)
412    $!
413    $ set command perl /table=sys$common:[syslib]dcltables.exe -
414     /output=sys$common:[syslib]dcltables.exe
415    $ install replace sys$common:[syslib]dcltables.exe
416    $ exit
417
418=head2 INSTALLing Perl images (optional) on VMS
419
420On systems that are using perl quite a bit, and particularly those with
421minimal RAM, you can boost the performance of perl by INSTALLing it as
422a known image.  PERLSHR.EXE is typically larger than 3000 blocks
423and that is a reasonably large amount of IO to load each time perl is
424invoked.
425
426   INSTALL ADD PERLSHR/SHARE
427   INSTALL ADD PERL/HEADER
428
429should be enough for F<PERLSHR.EXE> (/share implies /header and /open),
430while /HEADER should do for FPERL.EXE> (perl.exe is not a shared image).
431
432If your code 'use's modules, check to see if there is a shareable image for
433them, too.  In the base perl build, POSIX, IO, Fcntl, Opcode, SDBM_File,
434DCLsym, and Stdio, and other extensions all have shared images that can be
435installed /SHARE.
436
437How much of a win depends on your memory situation, but if you are firing
438off perl with any regularity (like more than once every 20 seconds or so)
439it is probably beneficial to INSTALL at least portions of perl.
440
441While there is code in perl to remove privileges as it runs you are advised
442to NOT INSTALL F<PERL.EXE> with PRIVs!
443
444=head2 Running h2ph to create perl header files (optional) on VMS
445
446If using HP C, ensure that you have extracted loose versions of your
447compiler's header or *.H files.  Be sure to check the contents of:
448
449    SYS$LIBRARY:DECC$RTLDEF.TLB
450    SYS$LIBRARY:SYS$LIB_C.TLB
451    SYS$LIBRARY:SYS$STARLET_C.TLB
452
453etcetera.
454
455If using GNU cc then also check your GNU_CC:[000000...] tree for the locations
456of the GNU cc headers.
457
458=head1 Reporting Bugs
459
460If you come across what you think might be a bug in Perl, please report
461it. The issue tracker at L<https://github.com/Perl/perl5/issues> walks you
462through the process of creating a bug report and including details of your
463installation.
464
465=head1 CAVEATS
466
467Probably the single biggest gotcha in compiling Perl is giving the wrong
468switches to MMS/MMK when you build. Use I<exactly> what the configure.com
469script prints!
470
471Be sure that the process that you use to build Perl has a PGFLQUO of at
472least 400000.  Be sure to have a correct local time zone to UTC offset
473defined (in seconds) in the logical name SYS$TIMEZONE_DIFFERENTIAL before
474running the regression test suite.  The SYS$MANAGER:UTC$CONFIGURE_TDF.COM
475procedure will help you set that logical for your system but may require
476system privileges.  For example, a location 5 hours west of UTC (such as
477the US East coast while not on daylight savings time) would have:
478
479    DEFINE SYS$TIMEZONE_DIFFERENTIAL "-18000"
480
481A final thing that causes trouble is leftover pieces from a failed
482build.  If things go wrong make sure you do a "(MMK|MMS|make) realclean"
483before you rebuild.
484
485=head2 Floating Point Considerations
486
487Prior to 5.8.0, Perl simply accepted the default floating point options of the
488C compiler, namely representing doubles with G_FLOAT on Alpha.  Single
489precision floating point values are represented in F_FLOAT format when either
490D_FLOAT or G_FLOAT is in use for doubles.  Beginning with 5.8.0, Alpha builds
491now use IEEE floating point formats by default, which in VMS parlance are S_FLOAT
492for singles and T_FLOAT for doubles.  Itanium builds have always used IEEE by
493default. The  available non-default options are D_FLOAT or G_FLOAT on Alpha
494or Itanium.
495
496The use of IEEE introduces NaN, infinity, and denormalization capabilities not
497available with D_FLOAT and G_FLOAT.  When using one of those non-IEEE formats,
498silent underflow and overflow are emulated in the conversion of strings to
499numbers, but it is preferable to get the real thing by using IEEE where possible.
500You are likely to see quite a few test failures when not using IEEE floating point.
501
502Regardless of what floating point format you consider preferable, be aware
503that the choice may have an impact on compatibility with external libraries,
504such as database interfaces, and with existing data, such as data created with
505the C<pack> function and written to disk, or data stored via the Storable
506extension.  For example, a C<pack("d", $foo)")> will create a D_FLOAT,
507G_FLOAT, or T_FLOAT depending on what your Perl was configured with.  When
508written to disk, the value can only be retrieved later by a Perl configured
509with the same floating point option that was in effect when it was created.
510
511To obtain a non-IEEE build, simply answer no to the "Use IEEE math?" question
512during the configuration or specify -"Uuseieee" as a parameter to configure.com
513on the command line.
514
515=head1 Mailing Lists
516
517There are several mailing lists available to the Perl porter.  For VMS
518specific issues (including both Perl questions and installation problems)
519there is the VMSPERL mailing list.  It is usually a low-volume (10-12
520messages a week) mailing list.
521
522To subscribe, send a mail message to VMSPERL-SUBSCRIBE@PERL.ORG. The VMSPERL
523mailing list address is VMSPERL@PERL.ORG.  Any mail sent there gets echoed
524to all subscribers of the list.  There is an archive of the list
525on the web at:
526
527    L<https://www.nntp.perl.org/group/perl.vmsperl/>
528
529To unsubscribe from VMSPERL send a message to VMSPERL-UNSUBSCRIBE@PERL.ORG.
530Be sure to do so from the subscribed account that you are canceling.
531
532=head2 Web sites for Perl on VMS
533
534Vmsperl pages on the web include:
535
536    L<http://www.sidhe.org/vmsperl/index.html>
537    L<https://www.cpan.org/modules/by-module/VMS/>
538    L<https://www.nntp.perl.org/group/perl.vmsperl/>
539    L<https://sourceforge.net/projects/vmsperlkit/>
540
541=head1 SEE ALSO
542
543Perl information for users and programmers about the port of perl to VMS is
544available from the [.pod]perlvms.pod file that gets installed as L<perlvms>.
545For administrators the perlvms document also includes a detailed discussion
546of extending vmsperl with CPAN modules after Perl has been installed.
547
548=head1 AUTHORS
549
550Originally by Charles Bailey bailey@newman.upenn.edu.  See the git repository
551for history.
552
553=head1 ACKNOWLEDGEMENTS
554
555A real big thanks needs to go to Charles Bailey
556bailey@newman.upenn.edu, who is ultimately responsible for Perl 5.004
557running on VMS. Without him, nothing the rest of us have done would be at
558all important.
559
560There are, of course, far too many people involved in the porting and testing
561of Perl to mention everyone who deserves it, so please forgive us if we've
562missed someone.  That said, special thanks are due to the following:
563
564  Tim Adye T.J.Adye@rl.ac.uk
565     for the VMS emulations of getpw*()
566  David Denholm denholm@conmat.phys.soton.ac.uk
567     for extensive testing and provision of pipe and SocketShr code,
568  Mark Pizzolato mark@infocomm.com
569     for the getredirection() code
570  Rich Salz rsalz@bbn.com
571     for readdir() and related routines
572  Peter Prymmer pvhp@best.com
573     for extensive testing, as well as development work on
574     configuration and documentation for VMS Perl,
575  Dan Sugalski dan@sidhe.org
576     for extensive contributions to recent version support,
577     development of VMS-specific extensions, and dissemination
578     of information about VMS Perl,
579  the Stanford Synchrotron Radiation Laboratory and the
580     Laboratory of Nuclear Studies at Cornell University for
581     the opportunity to test and develop for the AXP,
582  John Hasstedt John.Hasstedt@sunysb.edu
583     for VAX VMS V7.2 support
584  John Malmberg wb8tyw@qsl.net
585     for ODS-5 filename handling and other modernizations
586
587and to the entire VMSperl group for useful advice and suggestions.  In
588addition the perl5-porters deserve credit for their creativity and
589willingness to work with the VMS newcomers.  Finally, the greatest debt of
590gratitude is due to Larry Wall larry@wall.org, for having the ideas which
591have made our sleepless nights possible.
592
593Thanks,
594The VMSperl group
595
596=cut
597
598

README.vos

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see. It is written in the POD format (see pod/perlpod.pod) which is
5specially designed to be readable as is.
6
7=head1 NAME
8
9perlvos - Perl for Stratus OpenVOS
10
11=head1 SYNOPSIS
12
13This file contains notes for building perl on the Stratus OpenVOS
14operating system.  Perl is a scripting or macro language that is
15popular on many systems.  See L<perlbook> for a number of good books
16on Perl.
17
18These are instructions for building Perl from source.  This version of
19Perl requires the dynamic linking support that is found in OpenVOS
20Release 17.1 and thus is not supported on OpenVOS Release 17.0 or
21earlier releases.
22
23If you are running VOS Release 14.4.1 or later, you can obtain a
24pre-compiled, supported copy of perl by purchasing the GNU Tools
25product from Stratus Technologies.
26
27=head1 BUILDING PERL FOR OPENVOS
28
29To build perl from its source code on the Stratus V Series platform
30you must have OpenVOS Release 17.1.0 or later, GNU Tools Release
313.5 or later, and the C/POSIX Runtime Libraries.
32
33Follow the normal instructions for building perl; e.g, enter bash, run
34the Configure script, then use "gmake" to build perl.
35
36=head1 INSTALLING PERL IN OPENVOS
37
38=over 4
39
40=item 1
41
42After you have built perl using the Configure script, ensure that you
43have modify and default write permission to C<< >system>ported >> and
44all subdirectories.  Then type
45
46     gmake install
47
48=item 2
49
50While there are currently no architecture-specific extensions or
51modules distributed with perl, the following directories can be
52used to hold such files (replace the string VERSION by the
53appropriate version number):
54
55     >system>ported>lib>perl5>VERSION>i786
56
57=item 3
58
59Site-specific perl extensions and modules can be installed in one of
60two places.  Put architecture-independent files into:
61
62     >system>ported>lib>perl5>site_perl>VERSION
63
64Put site-specific architecture-dependent files into one of the
65following directories:
66
67     >system>ported>lib>perl5>site_perl>VERSION>i786
68
69=item 4
70
71You can examine the @INC variable from within a perl program
72to see the order in which Perl searches these directories.
73
74=back
75
76=head1 USING PERL IN OPENVOS
77
78=head2 Restrictions of Perl on OpenVOS
79
80This port of Perl version 5 prefers Unix-style, slash-separated
81pathnames over OpenVOS-style greater-than-separated pathnames.
82OpenVOS-style pathnames should work in most contexts, but if you have
83trouble, replace all greater-than characters by slash characters.
84Because the slash character is used as a pathname delimiter, Perl
85cannot process OpenVOS pathnames containing a slash character in a
86directory or file name; these must be renamed.
87
88This port of Perl also uses Unix-epoch date values internally.
89As long as you are dealing with ASCII character string
90representations of dates, this should not be an issue.  The
91supported epoch is January 1, 1980 to January 17, 2038.
92
93See the file pod/perlport.pod for more information about the OpenVOS
94port of Perl.
95
96=head1 TEST STATUS
97
98A number of the perl self-tests fails for various reasons; generally
99these are minor and due to subtle differences between common
100POSIX-based environments and the OpenVOS POSIX environment.  Ensure
101that you conduct sufficient testing of your code to guarantee that it
102works properly in the OpenVOS environment.
103
104=head1 SUPPORT STATUS
105
106I'm offering this port "as is".  You can ask me questions, but I
107can't guarantee I'll be able to answer them.  There are some
108excellent books available on the Perl language; consult a book
109seller.
110
111If you want a supported version of perl for OpenVOS, purchase the
112OpenVOS GNU Tools product from Stratus Technologies, along with a
113support contract (or from anyone else who will sell you support).
114
115=head1 AUTHOR
116
117Paul Green (Paul.Green@stratus.com)
118
119=head1 LAST UPDATE
120
121February 28, 2013
122
123=cut
124

README.win32

1# vim: syntax=pod
2
3If you read this file _as_is_, just ignore the funny characters you
4see. It is written in the POD format (see pod/perlpod.pod) which is
5specially designed to be readable as is.
6
7=head1 NAME
8
9perlwin32 - Perl under Windows
10
11=head1 SYNOPSIS
12
13These are instructions for building Perl under Windows 7 and later.
14
15=head1 DESCRIPTION
16
17Before you start, you should glance through the README file
18found in the top-level directory to which the Perl distribution
19was extracted.  Make sure you read and understand the terms under
20which this software is being distributed.
21
22Also make sure you read L</BUGS AND CAVEATS> below for the
23known limitations of this port.
24
25The INSTALL file in the perl top-level has much information that is
26only relevant to people building Perl on Unix-like systems.  In
27particular, you can safely ignore any information that talks about
28"Configure".
29
30You may also want to look at one other option for building a perl that
31will work on Windows: the README.cygwin file, which give a different
32set of rules to build a perl for Windows.  This method will probably
33enable you to build a more Unix-compatible perl, but you will also
34need to download and use various other build-time and run-time support
35software described in that file.
36
37This set of instructions is meant to describe a so-called "native"
38port of Perl to the Windows platform.  This includes both 32-bit and
3964-bit Windows operating systems.  The resulting Perl requires no
40additional software to run (other than what came with your operating
41system).  Currently, this port is capable of using one of the
42following compilers on the Intel x86 and x86_64 architectures:
43
44      Microsoft Visual C++    version 12.0 or later
45      Intel C++ Compiler      (experimental)
46      Gcc by mingw.org        gcc version 3.4.5-5.3.0
47      Gcc by mingw-w64.org    gcc version 4.4.3 or later
48
49Note that the last two of these are actually competing projects both
50delivering complete gcc toolchain for MS Windows:
51
52=over 4
53
54=item L<https://osdn.net/projects/mingw/>
55
56Delivers gcc toolchain building 32-bit executables (which can be used both 32 and 64 bit Windows platforms)
57
58=item L<https://mingw-w64.org>
59
60Delivers gcc toolchain targeting both 64-bit Windows and 32-bit Windows
61platforms (despite the project name "mingw-w64" they are not only 64-bit
62oriented). They deliver the native gcc compilers and cross-compilers
63that are also supported by perl's makefile.
64
65=back
66
67The Microsoft Visual C++ compilers are also now being given away free. They
68are available as "Visual C++ 2013-2022 Community Edition" and are the same
69compilers that ship with "Visual C++ 2013-2022 Professional".
70
71Visual C++ 2013 is capable of B<targeting> XP and Windows Server 2003 but the
72build host requirement is Windows 7/Windows Server 2012. For more details see
73https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-compatibility-vs
74and
75https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-sysrequirements-vs
76
77The MinGW64 compiler is available at L<https://mingw-w64.org>.
78The latter is actually a cross-compiler targeting Win64. There's also a trimmed
79down compiler (no java, or gfortran) suitable for building perl available at:
80L<https://strawberryperl.com/package/kmx/64_gcctoolchain/>
81
82NOTE: If you're using a 32-bit compiler to build perl on a 64-bit Windows
83operating system, then you should set the WIN64 environment variable to "undef".
84Also, the trimmed down compiler only passes tests when USE_ITHREADS *= define
85(as opposed to undef) and when the CFG *= Debug line is commented out.
86
87This port fully supports MakeMaker (the set of modules that
88is used to build extensions to perl).  Therefore, you should be
89able to build and install most extensions found in the CPAN sites.
90See L</Usage Hints for Perl on Windows> below for general hints about this.
91
92=head2 Setting Up Perl on Windows
93
94=over 4
95
96=item Make
97
98You need a "make" program to build the sources.  If you are using
99Visual C++, you can use nmake supplied with Visual C++.
100You may also use gmake instead of nmake.  Builds using gcc need
101gmake. nmake is not supported for gcc builds.  Parallel building is only
102supported with gmake, not nmake.
103
104=item Command Shell
105
106Use the default "cmd" shell that comes with Windows.  Some versions of the
107popular 4DOS/NT shell have incompatibilities that may cause you trouble.
108If the build fails under that shell, try building again with the cmd
109shell.
110
111Make sure the path to the build directory does not contain spaces.  The
112build usually works in this circumstance, but some tests will fail.
113
114=item Microsoft Visual C++
115
116The nmake that comes with Visual C++ will suffice for building. Visual C++
117requires that certain things be set up in the console before Visual C++ will
118successfully run. To make a console box be able to run the C compiler, you will
119need to beforehand, run C<vcvarsall.bat x86> to compile for x86-32 and for
120x86-64 C<vcvarsall.bat amd64>. On a typical install of a Microsoft C++
121compiler product, these batch files will already be in your C<PATH>
122environment variable so you may just type them without an absolute path into
123your console. If you need to find the absolute path to the batch file, it is
124usually found somewhere like
125C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC.
126With some newer Microsoft C products (released after ~2004), the installer will
127put a shortcut in the start menu to launch a new console window with the
128console already set up for your target architecture (x86-32 or x86-64 or IA64).
129With the newer compilers, you may also use the older batch files if you choose
130so.
131
132=item Microsoft Visual C++ 2013-2022 Community Edition
133
134These free versions of Visual C++ 2013-2022 Professional contain the same
135compilers and linkers that ship with the full versions, and also contain
136everything necessary to build Perl.
137
138These packages can be downloaded from L<https://visualstudio.microsoft.com/>.
139
140Install Visual C++ 2013-2022 Community, then setup your environment
141using, e.g.
142
143F<C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\vsvars32.bat>
144
145(assuming the default installation location was chosen).
146
147Perl should now build using the F<win32/Makefile>.  You will need to edit that
148file to set C<CCTYPE> to one of C<MSVC120>-C<MSVC143> first.
149
150=item Microsoft C++ Build Tools
151
152There's also a standalone (IDE-less) version of the build tools mentioned
153above containing the MSVC compiler available for download from
154L<https://visualstudio.microsoft.com/visual-cpp-build-tools/>.
155
156This is also referred to as I<Build Tools for Visual Studio>.
157
158=item GCC
159
160Perl can be compiled with gcc from MinGW (version 3.4.5 or later) or from
161MinGW64 (version 4.4.3 or later).  It can be downloaded here:
162
163L<https://osdn.net/projects/mingw/>
164L<https://www.mingw-w64.org/>
165
166You also need gmake. Usually it comes with MinGW but its executable may have
167a different name, such as mingw32-make.exe.
168
169Note that the MinGW build currently fails with version 6.3.0 or later.
170
171Note also that the C++ mode build currently fails with MinGW 3.4.5 and 4.7.2
172or later, and with MinGW64 64-bit 6.3.0 or later.
173
174=item Intel C++ Compiler
175
176Experimental support for using Intel C++ Compiler has been added. Edit
177F<win32/Makefile> and pick the correct C<CCTYPE> for the Visual C that Intel C
178was installed into. Also uncomment C<__ICC> to enable Intel C on Visual C support.
179To set up the build environment, from the Start Menu run
180IA-32 Visual Studio 20__ mode or Intel 64 Visual Studio 20__ mode as
181appropriate. Then run C<nmake> as usual in that prompt box.
182
183Only Intel C++ Compiler v12.1 has been tested. Other versions probably will
184work. Using Intel C++ Compiler instead of Visual C has the benefit of C99
185compatibility which is needed by some CPAN XS modules, while maintaining
186compatibility with Visual C object code and Visual C debugging infrastructure
187unlike GCC.
188
189=back
190
191=head2 Building
192
193=over 4
194
195=item *
196
197Make sure you are in the F<win32> subdirectory under the perl toplevel.
198This directory contains a F<Makefile> that will work with
199versions of C<nmake> that come with Visual C++, and
200a GNU make F<GNUmakefile> that will work for all supported compilers.
201The defaults in the C<gmake> makefile are set up to build with MinGW/gcc.
202
203=item *
204
205Edit the F<GNUmakefile> (or F<Makefile>, if you're using F<nmake>) and change
206the values of I<INST_DRV> and C<INST_TOP>. You can also enable various build
207flags. These are explained in the makefiles.
208
209Note that it is generally not a good idea to try to build a C<perl> with
210C<INST_DRV> and C<INST_TOP> set to a path that already exists from a previous
211build.  In particular, this may cause problems with the
212F<lib/ExtUtils/t/Embed.t> test, which attempts to build a test program and
213may end up building against the installed C<perl>'s F<lib/CORE> directory
214rather than the one being tested.
215
216You will have to make sure that C<CCTYPE> is set correctly and that
217C<CCHOME> points to wherever you installed your compiler.  For GCC this
218should be the directory that contains the F<bin>, F<include> and
219F<lib> directories.
220
221If building with the cross-compiler provided by
222mingw-w64.org you'll need to uncomment the line that sets
223C<GCCCROSS> in the F<GNUmakefile>. Do this only if it's the cross-compiler,
224ie. only if the F<bin> folder doesn't contain a F<gcc.exe>. (The cross-compiler
225does not provide a F<gcc.exe>, F<g++.exe>, F<ar.exe>, etc. Instead, all of these
226executables are prefixed with C<x86_64-w64-mingw32->.)
227
228The default value for C<CCHOME> in the makefiles for Visual C++
229may not be correct for some versions.  Make sure the default exists
230and is valid.
231
232If you want build some core extensions statically into C<perl>'s DLL,
233specify them in the C<STATIC_EXT> macro.
234
235Be sure to read the instructions near the top of the makefiles carefully.
236
237=item *
238
239Type C<gmake> (or C<nmake> if you are using that version of C<make>).
240
241This should build everything.  Specifically, it will create F<perl.exe>,
242F<perl538.dll> at the perl toplevel, and various other extension DLL's
243under the F<lib\auto> directory.  If the build fails for any reason, make
244sure you have done the previous steps correctly.
245
246To try C<gmake>'s parallel mode, type C<gmake -j2> where C<2> is the maximum number
247of parallel jobs you want to run. A number of things in the build process will
248run in parallel, but there are serialization points where you will see just 1
249CPU maxed out. This is normal.
250
251If you are advanced enough with building C code, here is a suggestion to speed
252up building C<perl>, and the later C<make test>. Try to keep your C<PATH> environment
253variable with the least number of folders possible (remember to keep your C
254compiler's folders there). F<C:\WINDOWS\system32> or F<C:\WINNT\system32>
255depending on your OS version should be first folder in C<PATH>, since C<cmd.exe>
256is the most commonly launched program during the build and later testing.
257
258=back
259
260=head2 Testing Perl on Windows
261
262Type "gmake test" (or "nmake test").  This will run most
263of the tests from the testsuite (many tests will be skipped).
264
265There should be no test failures.
266
267If you build with Visual C++ 2013 then three tests currently may fail with
268Daylight Saving Time related problems: F<t/io/fs.t>,
269F<cpan/HTTP-Tiny/t/110_mirror.t> and F<lib/File/Copy.t>. The failures are
270caused by bugs in the CRT in VC++ 2013 which are fixed in VC++2015 and
271later, as explained by Microsoft here:
272L<https://connect.microsoft.com/VisualStudio/feedback/details/811534/utime-sometimes-fails-to-set-the-correct-file-times-in-visual-c-2013>. In the meantime,
273if you need fixed C<stat> and C<utime> functions then have a look at the
274CPAN distribution Win32::UTCFileTime.
275
276If you build with Visual C++ 2015 or later then F<ext/XS-APItest/t/locale.t>
277may crash (after all its tests have passed). This is due to a regression in the
278Universal CRT introduced in the Windows 10 April 2018 Update, and will be fixed
279in the May 2019 Update, as explained here: L<https://developercommunity.visualstudio.com/content/problem/519486/setlocalelc-numeric-iso-latin-16-fails-then-succee.html>.
280
281If you build with certain versions (e.g. 4.8.1) of gcc from mingw then
282F<ext/POSIX/t/time.t> may fail test 17 due to a known bug in those gcc builds:
283see L<https://sourceforge.net/p/mingw/bugs/2152/>.
284
285Some test failures may occur if you use a command shell other than the
286native "cmd.exe", or if you are building from a path that contains
287spaces.  So don't do that.
288
289If you are running the tests from a emacs shell window, you may see
290failures in op/stat.t.  Run "gmake test-notty" in that case.
291
292Furthermore, you should make sure that during C<make test> you do not
293have any GNU tool packages in your path: some toolkits like Unixutils
294include some tools (C<type> for instance) which override the Windows
295ones and makes tests fail. Remove them from your path while testing to
296avoid these errors.
297
298To see the output of specific failing tests run the harness from the t
299directory:
300
301  # assuming you're starting from the win32 directory
302  cd ..\win32
303  .\perl harness <list of tests>
304
305Please report any other failures as described under L</BUGS AND CAVEATS>.
306
307=head2 Installation of Perl on Windows
308
309Type "gmake install" ("nmake install").  This will
310put the newly built perl and the libraries under whatever C<INST_TOP>
311points to in the Makefile.  It will also install the pod documentation
312under C<$INST_TOP\$INST_VER\lib\pod> and HTML versions of the same
313under C<$INST_TOP\$INST_VER\lib\pod\html>.
314
315To use the Perl you just installed you will need to add a new entry to
316your PATH environment variable: C<$INST_TOP\bin>, e.g.
317
318    set PATH=c:\perl\bin;%PATH%
319
320If you opted to uncomment C<INST_VER> and C<INST_ARCH> in the makefile
321then the installation structure is a little more complicated and you will
322need to add two new PATH components instead: C<$INST_TOP\$INST_VER\bin> and
323C<$INST_TOP\$INST_VER\bin\$ARCHNAME>, e.g.
324
325    set PATH=c:\perl\5.6.0\bin;c:\perl\5.6.0\bin\MSWin32-x86;%PATH%
326
327=head2 Usage Hints for Perl on Windows
328
329=over 4
330
331=item Environment Variables
332
333The installation paths that you set during the build get compiled
334into perl, so you don't have to do anything additional to start
335using that perl (except add its location to your PATH variable).
336
337If you put extensions in unusual places, you can set PERL5LIB
338to a list of paths separated by semicolons where you want perl
339to look for libraries.  Look for descriptions of other environment
340variables you can set in L<perlrun>.
341
342You can also control the shell that perl uses to run system() and
343backtick commands via PERL5SHELL.  See L<perlrun>.
344
345Perl does not depend on the registry, but it can look up certain default
346values if you choose to put them there unless disabled at build time with
347USE_NO_REGISTRY.  On Perl process start Perl checks if
348C<HKEY_CURRENT_USER\Software\Perl> and C<HKEY_LOCAL_MACHINE\Software\Perl>
349exist.  If the keys exists, they will be checked for remainder of the Perl
350process's run life for certain entries.  Entries in
351C<HKEY_CURRENT_USER\Software\Perl> override entries in
352C<HKEY_LOCAL_MACHINE\Software\Perl>.  One or more of the following entries
353(of type REG_SZ or REG_EXPAND_SZ) may be set in the keys:
354
355 lib-$]        version-specific standard library path to add to @INC
356 lib           standard library path to add to @INC
357 sitelib-$]    version-specific site library path to add to @INC
358 sitelib       site library path to add to @INC
359 vendorlib-$]  version-specific vendor library path to add to @INC
360 vendorlib     vendor library path to add to @INC
361 PERL*         fallback for all %ENV lookups that begin with "PERL"
362
363Note the C<$]> in the above is not literal.  Substitute whatever version
364of perl you want to honor that entry, e.g. C<5.6.0>.  Paths must be
365separated with semicolons, as usual on Windows.
366
367=item File Globbing
368
369By default, perl handles file globbing using the File::Glob extension,
370which provides portable globbing.
371
372If you want perl to use globbing that emulates the quirks of DOS
373filename conventions, you might want to consider using File::DosGlob
374to override the internal glob() implementation.  See L<File::DosGlob> for
375details.
376
377=item Using perl from the command line
378
379If you are accustomed to using perl from various command-line
380shells found in UNIX environments, you will be less than pleased
381with what Windows offers by way of a command shell.
382
383The crucial thing to understand about the Windows environment is that
384the command line you type in is processed twice before Perl sees it.
385First, your command shell (usually CMD.EXE) preprocesses the command
386line, to handle redirection, environment variable expansion, and
387location of the executable to run. Then, the perl executable splits
388the remaining command line into individual arguments, using the
389C runtime library upon which Perl was built.
390
391It is particularly important to note that neither the shell nor the C
392runtime do any wildcard expansions of command-line arguments (so
393wildcards need not be quoted).  Also, the quoting behaviours of the
394shell and the C runtime are rudimentary at best (and may, if you are
395using a non-standard shell, be inconsistent).  The only (useful) quote
396character is the double quote (").  It can be used to protect spaces
397and other special characters in arguments.
398
399The Windows documentation describes the shell parsing rules here:
400L<https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd>
401and the C runtime parsing rules here:
402L<https://msdn.microsoft.com/en-us/library/17w5ykft%28v=VS.100%29.aspx>.
403
404Here are some further observations based on experiments: The C runtime
405breaks arguments at spaces and passes them to programs in argc/argv.
406Double quotes can be used to prevent arguments with spaces in them from
407being split up.  You can put a double quote in an argument by escaping
408it with a backslash and enclosing the whole argument within double quotes.
409The backslash and the pair of double quotes surrounding the argument will
410be stripped by the C runtime.
411
412The file redirection characters "E<lt>", "E<gt>", and "|" can be quoted by
413double quotes (although there are suggestions that this may not always
414be true).  Single quotes are not treated as quotes by the shell or
415the C runtime, they don't get stripped by the shell (just to make
416this type of quoting completely useless).  The caret "^" has also
417been observed to behave as a quoting character, but this appears
418to be a shell feature, and the caret is not stripped from the command
419line, so Perl still sees it (and the C runtime phase does not treat
420the caret as a quote character).
421
422Here are some examples of usage of the "cmd" shell:
423
424This prints two doublequotes:
425
426    perl -e "print '\"\"' "
427
428This does the same:
429
430    perl -e "print \"\\\"\\\"\" "
431
432This prints "bar" and writes "foo" to the file "blurch":
433
434    perl -e "print 'foo'; print STDERR 'bar'" > blurch
435
436This prints "foo" ("bar" disappears into nowhereland):
437
438    perl -e "print 'foo'; print STDERR 'bar'" 2> nul
439
440This prints "bar" and writes "foo" into the file "blurch":
441
442    perl -e "print 'foo'; print STDERR 'bar'" 1> blurch
443
444This pipes "foo" to the "less" pager and prints "bar" on the console:
445
446    perl -e "print 'foo'; print STDERR 'bar'" | less
447
448This pipes "foo\nbar\n" to the less pager:
449
450    perl -le "print 'foo'; print STDERR 'bar'" 2>&1 | less
451
452This pipes "foo" to the pager and writes "bar" in the file "blurch":
453
454    perl -e "print 'foo'; print STDERR 'bar'" 2> blurch | less
455
456
457Discovering the usefulness of the "command.com" shell on Windows 9x
458is left as an exercise to the reader :)
459
460One particularly pernicious problem with the 4NT command shell for
461Windows is that it (nearly) always treats a % character as indicating
462that environment variable expansion is needed.  Under this shell, it is
463therefore important to always double any % characters which you want
464Perl to see (for example, for hash variables), even when they are
465quoted.
466
467=item Building Extensions
468
469The Comprehensive Perl Archive Network (CPAN) offers a wealth
470of extensions, some of which require a C compiler to build.
471Look in L<https://www.cpan.org/> for more information on CPAN.
472
473Note that not all of the extensions available from CPAN may work
474in the Windows environment; you should check the information at
475L<https://www.cpantesters.org/> before investing too much effort into
476porting modules that don't readily build.
477
478Most extensions (whether they require a C compiler or not) can
479be built, tested and installed with the standard mantra:
480
481    perl Makefile.PL
482    $MAKE
483    $MAKE test
484    $MAKE install
485
486where $MAKE is whatever 'make' program you have configured perl to
487use.  Use "perl -V:make" to find out what this is.  Some extensions
488may not provide a testsuite (so "$MAKE test" may not do anything or
489fail), but most serious ones do.
490
491It is important that you use a supported 'make' program, and
492ensure Config.pm knows about it.
493
494Note that MakeMaker actually emits makefiles with different syntax
495depending on what 'make' it thinks you are using.  Therefore, it is
496important that one of the following values appears in Config.pm:
497
498    make='nmake'	# MakeMaker emits nmake syntax
499    any other value	# MakeMaker emits generic make syntax
500    			    (e.g GNU make, or Perl make)
501
502If the value doesn't match the 'make' program you want to use,
503edit Config.pm to fix it.
504
505If a module implements XSUBs, you will need one of the supported
506C compilers.  You must make sure you have set up the environment for
507the compiler for command-line compilation before running C<perl Makefile.PL>
508or any invocation of make.
509
510If a module does not build for some reason, look carefully for
511why it failed, and report problems to the module author.  If
512it looks like the extension building support is at fault, report
513that with full details of how the build failed using the GitHub
514issue tracker at L<https://github.com/Perl/perl5/issues>.
515
516=item Command-line Wildcard Expansion
517
518The default command shells on DOS descendant operating systems (such
519as they are) usually do not expand wildcard arguments supplied to
520programs.  They consider it the application's job to handle that.
521This is commonly achieved by linking the application (in our case,
522perl) with startup code that the C runtime libraries usually provide.
523However, doing that results in incompatible perl versions (since the
524behavior of the argv expansion code differs depending on the
525compiler, and it is even buggy on some compilers).  Besides, it may
526be a source of frustration if you use such a perl binary with an
527alternate shell that *does* expand wildcards.
528
529Instead, the following solution works rather well. The nice things
530about it are 1) you can start using it right away; 2) it is more
531powerful, because it will do the right thing with a pattern like
532*/*/*.c; 3) you can decide whether you do/don't want to use it; and
5334) you can extend the method to add any customizations (or even
534entirely different kinds of wildcard expansion).
535
536 C:\> copy con c:\perl\lib\Wild.pm
537 # Wild.pm - emulate shell @ARGV expansion on shells that don't
538 use File::DosGlob;
539 @ARGV = map {
540	      my @g = File::DosGlob::glob($_) if /[*?]/;
541	      @g ? @g : $_;
542	    } @ARGV;
543 1;
544 ^Z
545 C:\> set PERL5OPT=-MWild
546 C:\> perl -le "for (@ARGV) { print }" */*/perl*.c
547 p4view/perl/perl.c
548 p4view/perl/perlio.c
549 p4view/perl/perly.c
550 perl5.005/win32/perlglob.c
551 perl5.005/win32/perllib.c
552 perl5.005/win32/perlglob.c
553 perl5.005/win32/perllib.c
554 perl5.005/win32/perlglob.c
555 perl5.005/win32/perllib.c
556
557Note there are two distinct steps there: 1) You'll have to create
558Wild.pm and put it in your perl lib directory. 2) You'll need to
559set the PERL5OPT environment variable.  If you want argv expansion
560to be the default, just set PERL5OPT in your default startup
561environment.
562
563If you are using the Visual C compiler, you can get the C runtime's
564command line wildcard expansion built into perl binary.  The resulting
565binary will always expand unquoted command lines, which may not be
566what you want if you use a shell that does that for you.  The expansion
567done is also somewhat less powerful than the approach suggested above.
568
569=item Notes on 64-bit Windows
570
571Windows .NET Server supports the LLP64 data model on the Intel Itanium
572architecture.
573
574The LLP64 data model is different from the LP64 data model that is the
575norm on 64-bit Unix platforms.  In the former, C<int> and C<long> are
576both 32-bit data types, while pointers are 64 bits wide.  In addition,
577there is a separate 64-bit wide integral type, C<__int64>.  In contrast,
578the LP64 data model that is pervasive on Unix platforms provides C<int>
579as the 32-bit type, while both the C<long> type and pointers are of
58064-bit precision.  Note that both models provide for 64-bits of
581addressability.
582
58364-bit Windows running on Itanium is capable of running 32-bit x86
584binaries transparently.  This means that you could use a 32-bit build
585of Perl on a 64-bit system.  Given this, why would one want to build
586a 64-bit build of Perl?  Here are some reasons why you would bother:
587
588=over
589
590=item *
591
592A 64-bit native application will run much more efficiently on
593Itanium hardware.
594
595=item *
596
597There is no 2GB limit on process size.
598
599=item *
600
601Perl automatically provides large file support when built under
60264-bit Windows.
603
604=item *
605
606Embedding Perl inside a 64-bit application.
607
608=back
609
610=back
611
612=head2 Running Perl Scripts
613
614Perl scripts on UNIX use the "#!" (a.k.a "shebang") line to
615indicate to the OS that it should execute the file using perl.
616Windows has no comparable means to indicate arbitrary files are
617executables.
618
619Instead, all available methods to execute plain text files on
620Windows rely on the file "extension".  There are three methods
621to use this to execute perl scripts:
622
623=over 8
624
625=item 1
626
627There is a facility called "file extension associations".  This can be
628manipulated via the two commands "assoc" and "ftype" that come
629standard with Windows.  Type "ftype /?" for a complete example of how
630to set this up for perl scripts (Say what?  You thought Windows
631wasn't perl-ready? :).
632
633=item 2
634
635Since file associations don't work everywhere, and there are
636reportedly bugs with file associations where it does work, the
637old method of wrapping the perl script to make it look like a
638regular batch file to the OS, may be used.  The install process
639makes available the "pl2bat.bat" script which can be used to wrap
640perl scripts into batch files.  For example:
641
642	pl2bat foo.pl
643
644will create the file "FOO.BAT".  Note "pl2bat" strips any
645.pl suffix and adds a .bat suffix to the generated file.
646
647If you use the 4DOS/NT or similar command shell, note that
648"pl2bat" uses the "%*" variable in the generated batch file to
649refer to all the command line arguments, so you may need to make
650sure that construct works in batch files.  As of this writing,
6514DOS/NT users will need a "ParameterChar = *" statement in their
6524NT.INI file or will need to execute "setdos /p*" in the 4DOS/NT
653startup file to enable this to work.
654
655=item 3
656
657Using "pl2bat" has a few problems:  the file name gets changed,
658so scripts that rely on C<$0> to find what they must do may not
659run properly; running "pl2bat" replicates the contents of the
660original script, and so this process can be maintenance intensive
661if the originals get updated often.  A different approach that
662avoids both problems is possible.
663
664A script called "runperl.bat" is available that can be copied
665to any filename (along with the .bat suffix).  For example,
666if you call it "foo.bat", it will run the file "foo" when it is
667executed.  Since you can run batch files on Windows platforms simply
668by typing the name (without the extension), this effectively
669runs the file "foo", when you type either "foo" or "foo.bat".
670With this method, "foo.bat" can even be in a different location
671than the file "foo", as long as "foo" is available somewhere on
672the PATH.  If your scripts are on a filesystem that allows symbolic
673links, you can even avoid copying "runperl.bat".
674
675Here's a diversion:  copy "runperl.bat" to "runperl", and type
676"runperl".  Explain the observed behavior, or lack thereof. :)
677Hint: .gnidnats llits er'uoy fi ,"lrepnur" eteled :tniH
678
679=back
680
681=head2 Miscellaneous Things
682
683A full set of HTML documentation is installed, so you should be
684able to use it if you have a web browser installed on your
685system.
686
687C<perldoc> is also a useful tool for browsing information contained
688in the documentation, especially in conjunction with a pager
689like C<less> (recent versions of which have Windows support).  You may
690have to set the PAGER environment variable to use a specific pager.
691"perldoc -f foo" will print information about the perl operator
692"foo".
693
694One common mistake when using this port with a GUI library like C<Tk>
695is assuming that Perl's normal behavior of opening a command-line
696window will go away.  This isn't the case.  If you want to start a copy
697of C<perl> without opening a command-line window, use the C<wperl>
698executable built during the installation process.  Usage is exactly
699the same as normal C<perl> on Windows, except that options like C<-h>
700don't work (since they need a command-line window to print to).
701
702If you find bugs in perl, you can report them to
703L<https://github.com/Perl/perl5/issues>.
704
705=head1 BUGS AND CAVEATS
706
707Norton AntiVirus interferes with the build process, particularly if
708set to "AutoProtect, All Files, when Opened". Unlike large applications
709the perl build process opens and modifies a lot of files. Having the
710AntiVirus scan each and every one slows build the process significantly.
711Worse, with PERLIO=stdio the build process fails with peculiar messages
712as the virus checker interacts badly with miniperl.exe writing configure
713files (it seems to either catch file part written and treat it as suspicious,
714or virus checker may have it "locked" in a way which inhibits miniperl
715updating it). The build does complete with
716
717   set PERLIO=perlio
718
719but that may be just luck. Other AntiVirus software may have similar issues.
720
721A git GUI shell extension for Windows such as TortoiseGit will cause the build
722and later C<make test> to run much slower since every file is checked for its
723git status as soon as it is created and/or modified. TortoiseGit doesn't cause
724any test failures or build problems unlike the antivirus software described
725above, but it does cause similar slowness. It is suggested to use Task Manager
726to look for background processes which use high CPU amounts during the building
727process.
728
729Some of the built-in functions do not act exactly as documented in
730L<perlfunc>, and a few are not implemented at all.  To avoid
731surprises, particularly if you have had prior exposure to Perl
732in other operating environments or if you intend to write code
733that will be portable to other environments, see L<perlport>
734for a reasonably definitive list of these differences.
735
736Not all extensions available from CPAN may build or work properly
737in the Windows environment.  See L</"Building Extensions">.
738
739Most C<socket()> related calls are supported, but they may not
740behave as on Unix platforms.  See L<perlport> for the full list.
741
742Signal handling may not behave as on Unix platforms (where it
743doesn't exactly "behave", either :).  For instance, calling C<die()>
744or C<exit()> from signal handlers will cause an exception, since most
745implementations of C<signal()> on Windows are severely crippled.
746Thus, signals may work only for simple things like setting a flag
747variable in the handler.  Using signals under this port should
748currently be considered unsupported.
749
750Please report detailed descriptions of any problems and solutions that
751you may find at E<lt>L<https://github.com/Perl/perl5/issues>E<gt>,
752along with the output produced by C<perl -V>.
753
754=head1 ACKNOWLEDGEMENTS
755
756The use of a camel with the topic of Perl is a trademark
757of O'Reilly and Associates, Inc. Used with permission.
758
759=head1 AUTHORS
760
761=over 4
762
763=item Gary Ng E<lt>71564.1743@CompuServe.COME<gt>
764
765=item Gurusamy Sarathy E<lt>gsar@activestate.comE<gt>
766
767=item Nick Ing-Simmons E<lt>nick@ing-simmons.netE<gt>
768
769=item Jan Dubois E<lt>jand@activestate.comE<gt>
770
771=item Steve Hay E<lt>steve.m.hay@googlemail.comE<gt>
772
773=back
774
775This document is maintained by Jan Dubois.
776
777=head1 SEE ALSO
778
779L<perl>
780
781=head1 HISTORY
782
783This port was originally contributed by Gary Ng around 5.003_24,
784and borrowed from the Hip Communications port that was available
785at the time.  Various people have made numerous and sundry hacks
786since then.
787
788GCC/mingw32 support was added in 5.005 (Nick Ing-Simmons).
789
790Support for PERL_OBJECT was added in 5.005 (ActiveState Tool Corp).
791
792Support for fork() emulation was added in 5.6 (ActiveState Tool Corp).
793
794Win9x support was added in 5.6 (Benjamin Stuhl).
795
796Support for 64-bit Windows added in 5.8 (ActiveState Corp).
797
798Last updated: 06 October 2021
799
800=cut
801