Subject: Perl 5.003 Beta port to AS/400 V3R2 now available
From: [email-masked] (David J. Fiander)
Date: 10 Dec 1996 19:32:20 GMT
Newsgroups: comp.lang.perl.announce,comp.lang.perl.misc

*********************************************************************
 *                                                                   *
 *  Announcing Perl Version 5.0.X for AS/400 Version 3 Release 2     *
 *                 Beta code availability for download               *
 *                      December 9, 1996                             *
 *                                                                   *
 *********************************************************************

IBM's AS/400 division and MKS have completed a beta port of perl
5.003 to that AS/400 Version 3, Release 2.

The Perl distribution for the AS/400 is packaged as two (2) SAVF
format files:

 - The perl source, libraries, and test suites (perlsrc.savf)
 - A precompiled perl executable with the perl libraries
          and test suites (perlpgm.savf)

These files are (or very soon will be) available at all CPAN
sites in the directory ports/as400.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

NOTE: Please see the installation notes and the readme which is
      included in the save file for complete unpack and installation
      instructions and any known problems and limitations.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

IBM will not provide service and support for this Perl beta. Do
not call IBM Support Line for assistance. Please send your
comments to the newsgroups comp.lang.perl.misc or
comp.sys.ibm.as400.misc, which we will be monitoring, or send
email. See http://www.as400.ibm.com/feedback/feedback.htm for an
easy to fill out form to send us feedback.  We really want your
feedback on the Perl beta implementation.

	  Installation and Build Notes for AS/400 Perl
	  --------------------------------------------

The Perl distribution for the AS/400 is packaged as two (2) SAVF
format files:

	- The perl source, libraries, and test suites
	- A precompiled perl executable with the perl libraries
          and test suites

The libraries and test suites are stored as a separate
SAVF-format file within the file you download.  Once you've
unpacked the save file you downloaded, you will have to unpack
the libraries and test suites.

Whether you download the source or the precompiled executable
depends on whether or not you have the AS/400 ILE/C compiler and
are interested in building from source.

Before ftping the save files onto your AS/400 system, you must
pre-create the destination save files so that ftp will store the
data properly:

	CRTSAVF FILE(*CURLIB/PERLSRC) TEXT('AS/400 Perl Source')
	CRTSAVF FILE(*CURLIB/PERLPGM) TEXT('AS/400 Perl Executable')

To unpack the save files, run the following commands:

	RSTOBJ OBJ(*ALL) SAVLIB(PERL5) DEV(*SAVF) SAVF(*CURLIB/PERLSRC)
	RSTOBJ OBJ(*ALL) SAVLIB(PERL5) DEV(*SAVF) SAVF(*CURLIB/PERLPGM)

If you downloaded the source distribution, you have to build the
executable:

	CALL PGM(PERL5/CRTPERLMOD)
	CALL PGM(PERL5/CRTPERLPGM)

Once you have an executable, you have to either add the library
PERL5 to your library list or move PERL5/PERL.PGM to a library in
your library list.

Finally, you have to install the perl script library into the HFS
from the save file that was unpacked from the distribution file:

	RST DEV('/QSYS.LIB/PERL5.LIB/PERLLIB.FILE')
	RST DEV('/QSYS.LIB/PERL5.LIB/PERLLIB.FILE')

You're now ready to program in perl.

		  Release Notes for AS/400 Perl
		  -----------------------------

The core perl language is fully supported on the AS/400, except
for the following issues:

- Because there is no relationship between the ANSI C FILEs
  stdin, stdout, and stderr and the POSIX file descriptors 0, 1,
  and 2, perl does not support redirecting these file descriptors
  using the

	open(STDOUT, ">boo");

  notation.  Nor does the dup() function support operating on
  STDIN, STDOUT, or STDERR.

- In the Beta, Because of the lack of support for pipes, the
  backquote operation and opening of pipes to processes with the
  open() function are not supported.

When using perl to develop Web CGI programs, there are two issues
that you must watch for:

- Because stdin, stdout, and stderr are provided as text-mode
  record-based files, your CGI program cannot write binary
  (eg. GIF) data to standard output, and the text produced by the
  CGI must consist of lines shorter that 254 characters.  Longer
  lines will be truncated.

- Perl scripts are not directly executable.  To invoke a perl
  program as a CGI, you must write a small CL program that will
  dispatch to the perl script itself.
There are also some issues related to the AS/400 environment that
developers porting scripts from other environments must be aware
of:

- The arguments to the perl system() function and any command
  substitutions (ie. backquoted strings) have to be written as
  OS/400 CL calls.  There are no Unix utilities available on the
  AS/400 at present, so programs that rely on them will have to
  be restructured to use the equivalent CL functionality.

- OS/400 doesn't support I/O redirection the same way that Unix
  does.  Pipes and command substitutions (backquoted strings) are
  implemented using a CL OVRDBF command to override STDOUT, which
  is supported by OS/4000 ILE/C.  If the programs being invoked
  do not refer to STDOUT, then the command substitution or pipe
  will not work correctly.

- Perl reads scripts and data out of the integrated filesystem
  (IFS).  To access native OS/400 files, you must use the
  IFS-style of name.  See the AS/400 documentation about the IFS
  for details about file naming. 

- The AS/400 is an EBCDIC system.  All scripts being transfered
  from ASCII environments will have to be translated.  FTP does
  this automatically for text transfers, as does the AS/400
  client access Windows file server when copying into the HFS.

- In the beta distribution, pipes are implemented using temporary
  files.  The pipe process runs to completion, and then perl
  reads the output produced by the sub-process.  That is, perl
  and the pipe process do not run in parallel as they would on a
  Unix system; if the pipe process doesn't exit, then perl will
  never run.  Similarly, perl cannot write to pipes in the beta
  distribution.

- For the beta distribution, all perl scripts and input data must
  be in CP-037 to function properly.