|
NAMEText::Bidi::Array - Base class for dual life arraysVERSIONversion 2.15SYNOPSISuse Text::Bidi::Array::Byte; my $a = new Text::Bidi::Array::Byte "abc"; say $a->[1]; # says 98 say $$a; # says abc say "$a"; # also says abc DESCRIPTIONThis is an abstract base class for objects that function as ``dual-life'' arrays: When viewed as an array reference, it functions as a usual array of numbers. When used as a scalar reference, it returns the same array as a packed string. The packing specification depends on the sub-class. These classes are used in Text::Bidi to conveniently pass arrays to the underlying fribidi library, but could be of independent interest.OVERLOADED OPERATORSAn object of this type can be dereferenced either as a scalar or as an array. In the first case, it returns the packed (string) representation of the array. In the second, it returns the unpacked array of numbers.The packed representation is also returned when the object is used as a string. CONSTRUCTION$a = new Text::Bidi::Array::<Type> $data Create a new array of the given Type, and initialise it with $data. $data can be either a string, which the new object then view as an array of the given type, or an array reference (more precisely, anything that can be dereferenced as an array), which is then packed according to the rules of Type. If no $data is given, it defaults to 0. SEE ALSOText::Bidi::Array::Byte, Text::Bidi::Array::LongFOR IMPLEMENTORSThe rest of this documentation is for writing specific derived classes. The object is represented internally as a hashref. To implement a particular instance, the following methods should be implemented. Each of these should manipulate the field "data", which is the string that stores the actual value. Unimplemented methods will lead to croaking. See Text::Bidi::Array::Byte and Text::Bidi::Array::Long for examples.
The following methods should behave as described in Tie::Array.
AUTHORMoshe Kamensky <kamensky@cpan.org>COPYRIGHT AND LICENSEThis software is copyright (c) 2015 by Moshe Kamensky.This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Visit the GSP FreeBSD Man Page Interface. |