Array-Base
view release on metacpan or search on metacpan
* consistently use THX_ prefix on internal function names
version 0.005; 2012-02-01
* bugfix: require bugfixed version of Lexical::SealRequireHints (for
compatibility with early-loaded warnings.pm) and invoke it earlier
to make sure it takes effect in time
* in doc, refer to String::Base for string index offsetting
* update documentation for $[ changes in Perl 5.15.3 and 5.15.5
* in Build.PL, declare incompatibility with pre-0.19
B::Hooks::OP::Check, which doesn't play nicely around op check hooking
* convert .cvsignore to .gitignore
version 0.004; 2011-07-27
* bugfix: require bugfixed version of Lexical::SealRequireHints (for
working around [perl #73174])
* document that Perls prior to 5.9.3 don't propagate the right lexical
state into string eval
version 0.003; 2011-04-09
* bugfix: correctly detect a type of malformed op tree that the module
can't process
* document that $[ is now due to disappear in Perl 5.15, changed
from 5.13
* on Perl 5.13.6+, use new API function op_contextualize() instead of
the core's private functions
* in XS, use PERL_NO_GET_CONTEXT for efficiency
* in XS, declare "PROTOTYPES: DISABLE" to prevent automatic generation
of unintended prototypes
with C++ compilers
* in Build.PL, explicitly declare configure-time requirements
* add MYMETA.yml to .cvsignore
version 0.001; 2009-10-21
* bugfix: correct behaviour of array slicing in scalar context
* bugfix: also influence list slicing and array splicing, as $[ does
* for Perl 5.11, also influence the new array keys() and each()
operators
* reorganise documentation, particularly expanding the comparison
with $[
* use integer arithmetic operators for efficiency
* test all combinations of scalar and list contexts
* in documentation, correct statement about when $[ is likely to be
removed from the core
* split test suite into one file per affected opcode
* check for required Perl version at runtime
version 0.000; 2009-09-27
* initial released version
lib/Array/Base.pm view on Meta::CPAN
array each (C<each(@a)>) (Perl 5.11 and later)
=back
Only forwards indexing, relative to the start of the array, is supported.
End-relative indexing, normally done using negative index values, is
not supported when an index offset is in effect. Use of an index that
is numerically less than the index offset will have unpredictable results.
=head2 Differences from C<$[>
This module is a replacement for the historical L<C<$[>|perlvar/$[>
variable. In early Perl that variable was a runtime global, affecting all
array and string indexing in the program. In Perl 5, assignment to C<$[>
acts as a lexically-scoped pragma. C<$[> is deprecated. The original
C<$[> was removed in Perl 5.15.3, and later replaced in Perl 5.15.5 by
an automatically-loaded L<arybase> module. This module reimplements
the index offset feature without any specific support from the core.
Unlike C<$[>, this module does not affect indexing into strings.
This module is concerned only with arrays. To influence string indexing,
see L<String::Base>.
This module does not show the offset value in C<$[> or any other
accessible variable. With the array offset being lexically scoped,
there should be no need to write code to handle a variable offset.
C<$[> has some predictable, but somewhat strange, behaviour for indexes
less than the offset. The behaviour differs slightly between slicing
and scalar indexing. This module does not attempt to replicate it,
and does not support end-relative indexing at all.
The last-index operator (C<$#a>), as implemented by the Perl core,
generates a magical scalar which is linked to the underlying array.
The numerical value of the scalar varies if the length of the array
is changed, and code with different C<$[> settings will see accordingly
different values. The scalar can also be written to, to change the length
of the array, and again the interpretation of the value written varies
according to the C<$[> setting of the code that is doing the writing.
This module does not replicate any of that behaviour. With an array
index offset from this module in effect, C<$#a> evaluates to an ordinary
rvalue scalar, giving the last index of the array as it was at the time
the operator was evaluated, according to the array index offset in effect
where the operator appears.
=cut
package Array::Base;
lib/Array/Base.pm view on Meta::CPAN
The additional operators generated by this module cause spurious warnings
if some of the affected array operations are used in void context.
Prior to Perl 5.9.3, the lexical state of array index offset does not
propagate into string eval.
=head1 SEE ALSO
L<String::Base>,
L<arybase>,
L<perlvar/$[>
=head1 AUTHOR
Andrew Main (Zefram) <zefram@fysh.org>
=head1 COPYRIGHT
Copyright (C) 2009, 2010, 2011, 2012, 2017
Andrew Main (Zefram) <zefram@fysh.org>
( run in 0.246 second using v1.01-cache-2.11-cpan-b61123c0432 )