Encode::RAD50 - Convert to and from the Rad50 character set.
use Encode; use Encode::RAD50; # Sorry about this. $rad50 = encode ('RAD50', 'FOO'); $ascii = decode ('rad50', pack 'n', 10215); binmode STDOUT, ':encoding(rad50)'; # Perverse, but it works. print 'A#C'; # Gives a warning, since '#' isn't valid.
Because this is not a standard encoding, you will need to explicitly
Though of course the name of the module is case-sensitive, the name of the encoding (passed to encode (), decode (), or ":encoding()") is not case-sensitive.
This package is designed to convert to and from the Rad50 character set. It's really a piece of retrocomputing, since this character set was, to the best of my knowledge, only used for the Digital (R.I.P.) PDP-11 computer, under (at least) the RSX-11 (including IAS and P/OS), RT-11, RSTS (-11 and /E) operating systems.
Rad50 is a way to squeeze three characters into two bytes, by restricting the character set to upper-case 7-bit ASCII letters, digits, space, "." and "$". There is also an encoding for what was called "the illegal character." In the language of the Encode modules this is the substitution character, and its ASCII representation is "?".
When more than three characters are encoded, the first three go in the first two bytes, the second three in the second two, and so on.
If you try to encode some number of characters other than a multiple of three, implicit spaces will be added to the right-hand end of the string. These will become explicit when you decode.
The astute observer will note that the character set does not have 50 characters. To which I reply that it does, if you count the invalid character and if your "50" is octal.
The test suite was verified using the RSX-11M+ "CVT" command. But the CVT command interprets "A" as though it were " A" (i.e. leading spaces), whereas this module interprets it as "A " (i.e. trailing spaces).
Nothing is actually exported by this package. The "encode" and "decode" in the synopsis come from the Encode package.
It is not clear to me that the PerlIO support is completely correct. But the test suite passes under cygwin, darwin, MSWin32, and VMS (to identify them by the contents of $^O).
The following methods should be considered public:
This is the decode method documented in Encode::Encoding. Though you can call it directly, the anticipated mechanism is via the decode subroutine exported by Encode.
This is the encode method documented in Encode::Encoding. Though you can call it directly, the anticipated mechanism is via the encode subroutine exported by Encode.
This class method causes Encode::RAD50 to ignore the WARN_ON_ERR flag. This is primarily for testing purposes, meaning that I couldn't figure out any other way to suppress the warnings when testing the handling of invalid characters in PerlIO.
If the argument is true, warnings are not generated even if the caller specifies the WARN_ON_ERROR flag. If the argument is false, warnings are generated if the caller specifies WARN_ON_ERROR. Either way, the previous value is returned.
If no argument is passed, you get the current setting. The initial setting is false.
Perlqq, HTML charref, and XML charref fallback modes are not supported, because the RAD50 character set does not have the necessary characters. In plainer language, you can't stick a backslash in the output stream if the backslash is an invalid character. Requests for these fallback modes will be ignored, and the replacement character inserted.
Steve Lionel's posting of the VAX Fortran IRAD50 to comp.os.vms provided the model for what encode should do if the length of the input string was not a multiple of three.
Brian, for flushing out more operating systems that used RAD50.
Nora Narum, for helping with RSX CVT syntax.
Thomas R. Wyant, III (wyant at cpan dot org)
Copyright 2005-2007, 2011-2014 by Thomas R. Wyant, III (wyant at cpan dot org). All rights reserved.
PDP-11, RSTS-11, RSTS/E, RSX-11, RSX-11M+, P/OS and RT-11 are trademarks of Hewlett-Packard Development Company, L.P.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.