This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Use pack/unpack for marshalling =head1 VERSION Maintainer: Ilya Zakharevich <[EMAIL PROTECTED]> Date: 16 September 2000 Mailing List: [EMAIL PROTECTED] Number: 249 Version: 1 Status: Developing =head1 ABSTRACT This RFC extends pack/unpack builtins to store/extract the TEMPLATE to/from the packed data. This allows storage of arbitrary Perl data. =head1 DESCRIPTION =over =item C<t> on unpack(): remove the last extracted value and use it as if it replaces this C<t>. For example, the following two calls are equivalent: unpack 'A5 t A5', 'aCx6,AcX6...0123456' unpack 'aCx6, A5', 'AcX6...0123456' on pack(): store the next argument so that it is extractable with C<'t'>, this C<t> acts as a modifier for the previous type. For example, pack 'A3 t', [5,6,[7,8],0] may be stored in many ways, one of them (most readable?) 'A7t' . ' A21 t ' . ' g[ A A g[ A A ] A ] ' . '56780' When this is unpacked with C<'A3 t'>, the first 3 chars are used as a new template, then the next 7 chars are used as a new template, then the next 21 chars are used as a new template, which finally extracts the structure. This example shows that an arbitrary large structure can be extracted using the template C<'A3 t'>. =item C<T> behaves the same as the C<A4 t>. (Syntactic sugar, optional). As shown above, arbitrary data is restorable by a simple 'T'. For example, pack 'T', [5,6,[7,8],0] may be stored in many ways, one of them (most readable?) 'A21t' . ' g[ A A g[ A A ] A ] ' . '56780' =back =head1 MIGRATION ISSUES None. =head1 IMPLEMENTATION Straightforward. =head1 REFERENCES RFC142: Enhanced Pack/Unpack RFC 246: pack/unpack uncontrovercial enhancements RFC 248: enhanced groups in pack/unpack