6 our @ISA = qw(Exporter DynaLoader);
7 our @EXPORT_OK = qw(sv_readonly_flag);
10 bootstrap Data::Util $VERSION;
18 Data::Util - A selection of general-utility data subroutines
22 use Data::Util qw(sv_readonly_flag);
24 my $sv_readonly = sv_readonly_flag(%some_data);
26 sv_readonly_flag(@some_data, 1); # Set the sv_readonly flag on
31 C<Data::Util> contains a selection of subroutines which are useful on
32 scalars, hashes and lists (and thus wouldn't fit into Scalar, Hash or
33 List::Util). All of the routines herein will work equally well on a
34 scalar, hash, list or even hash & list elements.
36 sv_readonly_flag($some_data);
37 sv_readonly_flag(@some_data);
38 sv_readonly_flag(%some_data);
39 sv_readonly_flag($some_data{key});
40 sv_readonly_flag($some_data[3]);
42 We'll just refer to the conglomeration as "DATA".
44 By default C<Data::Util> does not export any subroutines. You can ask
49 =item sv_readonly_flag
51 my $sv_readonly = sv_readonly_flag(DATA);
52 sv_readonly_flag(DATA, 1); # set sv_readonly true
53 sv_readonly_flag(DATA, 0); # set sv_readonly false
55 This gets/sets the sv_readonly flag on the given DATA. When setting
56 it returns the previous state of the flag. This is intended for
57 people I<that know what they're doing.>
59 The exact behavior exhibited by a piece of DATA when sv_readonly is
60 set depends on what type of data it is. B<It doesn't even necessarily
61 make the data readonly!> Look for specific functions in Scalar::Util,
62 List::Util and Hash::Util for making those respective types readonly.
66 Michael G Schwern <schwern@pobox.com> using XS code by Nick Ing-Simmons.
70 L<Scalar::Util>, L<List::Util>, L<Hash::Util>