Hi Jarkko and fellow Perl-EBCDICers,

yes, maybe perlebcdic, but so far it is only tested and valid for BS2000 of
course.  And of course I don't know if OS390 has something similar to ASCII
and EBCDIC filesystems and this automagical conversion with the environment
variable IO_CONVERSION=YES.  So I put the new text on the MVS mailing list
too:

-----8<-----
=head2 Using PerlIO and different encodings on ASCII and EBCDIC partitions

Since version 5.8 Perl uses the new PerlIO on BS2000.  This enables
you using different encodings per IO channel.  For example you may use

    use Encode;
    open($f, ">:encoding(ascii)", "test.ascii");
    print $f "Hello World!\n";
    open($f, ">:encoding(posix-bc)", "test.ebcdic");
    print $f "Hello World!\n";
    open($f, ">:encoding(latin1)", "test.latin1");
    print $f "Hello World!\n";
    open($f, ">:encoding(utf8)", "test.utf8");
    print $f "Hello World!\n";

to get two files containing "Hello World!\n" in ASCII, EBCDIC, ISO
Latin-1 (in this example identical to ASCII) respective UTF-EBCDIC (in
this example identical to normal EBCDIC).  See the documentation of
Encode::PerlIO for details.

As the PerlIO layer uses raw IO internally, all this totally ignores
the type of your filesystem (ASCII or EBCDIC) and the IO_CONVERSION
environment variable.  If you want to get the old behavior, that the
BS2000 IO functions determine conversion depending on the filesystem
PerlIO still is your friend.  You use IO_CONVERSION as usual and tell
Perl, that it should use the native IO layer:

    export IO_CONVERSION=YES
    export PERLIO=stdio

Now your IO would be ASCII on ASCII partitions and EBCDIC on EBCDIC
partitions.  See the documentation of PerlIO (without C<Encode::>!)
for further posibilities.
-----8<-----

So here are my questions to the OS390 folks:

Does the new PerlIO works like that for you too?

Do you have something like different filesystems with different encodings on
OS390?  (E.g. in our BS2000 Posix subsystem we have a root filesystem using
EBCDIC encoding and the developers home directories below /home on an ASCII
filesystem.  That way we can access the home directories with something
similar to Samba from our PCs.)

If yes, is there some automagical conversion done when working with files
from an ASCII filesystem?  (Above trick with the automatic conversion
switched on with the environment variable IO_CONVERSION works for almost
every program in the BS2000 Posix subsystem.)

Regards, Thomas Dorner
________________________________________
Thomas Dorner
Start Amadeus, General Services & Projects (D-G)
E-Mail: [EMAIL PROTECTED]


> ----------
> Von:  Jarkko Hietaniemi[SMTP:[EMAIL PROTECTED]
> Antwort an:   [EMAIL PROTECTED]
> Gesendet:     Dienstag, 26. August 2003 12:08
> An:   Dorner Thomas
> Cc:   '[EMAIL PROTECTED]'; 'Martin Kraemer'
> Betreff:      Re: Perl: new info for the README.bs2000
> 
> On Tue, Aug 26, 2003 at 09:55:37AM +0200, Dorner Thomas wrote:
> > Hi,
> > 
> > after playing around a bit with the 5.8.1 and the PerlIO layers, I
> thought
> > it would be a good idea to add a bit information about this topic
> ("Using
> > PerlIO and different encodings on ASCII and EBCDIC partitions") to the
> > README.bs2000.  So here's the unified diff:
> 
> Thanks!  The information looks interesting enough to mention elsewhere,
> too.  Maybe perlebcdic?
> 
> >  <<perl-5.8.1-RC4-3>> 
> > 
> > Regards, Thomas Dorner
> > ________________________________________
> > Thomas Dorner
> > Start Amadeus, General Services & Projects (D-G)
> > E-Mail: [EMAIL PROTECTED]
> > 
> 
> 
> 
> -- 
> Jarkko Hietaniemi <[EMAIL PROTECTED]> http://www.iki.fi/jhi/ "There is this
> special
> biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen
> 

Reply via email to