Acme-Playpen
view release on metacpan or search on metacpan
lib/Tupelo/Munge.pm view on Meta::CPAN
that the tuple currently has.
=item tuple_slot(TUPLE, INDEX)
I<TUPLE> must be a reference to a tuple. Returns the slot value (either a
reference or undefined) in the tuple's slot identified by the zero-based
index I<INDEX>. C<die>s if the index is out of bounds (less than zero,
or greater than or equal to the number of slots).
=item tuple_slots(TUPLE)
I<TUPLE> must be a reference to a tuple. Returns a list of the slot
values (each either a reference or undefined) in all the slots of
the tuple. C<die>s if called in scalar context.
=back
=head2 Mutation
=over
=item tuple_set_slot(TUPLE, INDEX, REF)
I<TUPLE> must be a reference to a mutable tuple. Sets the tuple's slot
identified by the zero-based index I<INDEX> to contain the slot value
supplied by I<REF>, which must be either a reference or undefined.
Returns the new slot value (i.e., a copy of I<REF>). C<die>s if the
index is out of bounds (less than zero, or greater than or equal to the
number of slots).
=item tuple_set_slots(TUPLE, REF ...)
I<TUPLE> must be a reference to a mutable tuple. Sets the tuple's
complete slot sequence to contain the slot values supplied by the I<REF>s,
each of which must be either a reference or undefined. Returns no
useful value. This function is capable of changing the number of slots
in a tuple, but doing so is a relatively expensive operation, so avoid
doing that routinely.
=item tuple_seal(TUPLE)
I<TUPLE> must be a reference to a mutable tuple. Makes the tuple
immutable. Returns a reference to the tuple (i.e., a copy of I<TUPLE>).
=back
=head1 BUGS
As of Perl 5.37.10, the L<C<bless>|perlfunc/bless> function in the Perl
core has a problem with tuples. Although it will bless an unblessed
tuple just as it will any other object, it refuses to bless a tuple that
is already blessed. It permits reblessing of objects other than tuples,
and so is discriminating against tuples. This prohibition appears to
be a result of concern for the integrity of classes of the core class
system, but isn't actually justified by such concerns. (It was added
alongside the prohibition on manually blessing into classes of the core
class system, a prohibition which is justified by such concerns.)
As of Perl 5.37.10, the Perl core provides no coherent semantics regarding
the mutability of tuples. It does not enforce immutability, by looking at
any flag attached to a tuple. This means that the immutability offered
by this module can be violated by exploiting core features. But the
core also assumes in some situations that tuples will not be mutated.
This immutability assumed by the core can be violated by the use of this
module, or by exploiting core features without any use of this module.
=head1 SEE ALSO
L<Scalar::Construct>
=head1 AUTHOR
Andrew Main (Zefram) <zefram@fysh.org>
=head1 COPYRIGHT
Copyright (C) 2023 Andrew Main (Zefram) <zefram@fysh.org>
=head1 LICENSE
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
1;
( run in 2.749 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )