File: Indexed.pm

package info (click to toggle)
libtie-hash-indexed-perl 0.05%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 168 kB
  • sloc: perl: 10; makefile: 10
file content (102 lines) | stat: -rw-r--r-- 2,832 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
################################################################################
#
# $Project: /Tie-Hash-Indexed $
# $Author: mhx $
# $Date: 2007/08/24 15:10:13 +0200 $
# $Revision: 6 $
# $Source: /lib/Tie/Hash/Indexed.pm $
#
################################################################################
# 
# Copyright (c) 2002-2003 Marcus Holland-Moritz. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
# 
################################################################################

package Tie::Hash::Indexed;
use 5.004;
use strict;
use DynaLoader;
use Tie::Hash;
use vars qw($VERSION @ISA);

@ISA = qw(DynaLoader Tie::Hash);
$VERSION = do { my @r = '$Snapshot: /Tie-Hash-Indexed/0.05 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' };

bootstrap Tie::Hash::Indexed $VERSION;

1;

__END__

=head1 NAME

Tie::Hash::Indexed - Ordered hashes for Perl

=head1 SYNOPSIS

  use Tie::Hash::Indexed;

  tie my %hash, 'Tie::Hash::Indexed';

  %hash = ( I => 1, n => 2, d => 3, e => 4 );
  $hash{x} = 5;

  print keys %hash, "\n";    # prints 'Index'
  print values %hash, "\n";  # prints '12345'

=head1 DESCRIPTION

Tie::Hash::Indexed is very similar to Tie::IxHash. However,
it is written completely in XS and usually about twice as
fast as Tie::IxHash. It's quite a lot faster when it comes
to clearing or deleting entries from large hashes.
Currently, only the plain tying mechanism is supported.

=head1 ENVIRONMENT

=head2 C<THI_DEBUG_OPT>

If Tie::Hash::Indexed is built with debugging support, you
can use this environment variable to specify debugging
options. Currently, the only useful values you can pass
in are C<d> or C<all>, which both enable debug output for
the module.

=head1 PROBLEMS

As the data of Tie::Hash::Indexed objects is hidden inside
the XS implementation, cloning/serialization is problematic.
Tie::Hash::Indexed implements hooks for Storable, so cloning
or serializing objects using Storable is safe.

Tie::Hash::Indexed tries very hard to detect any corruption
in its data at runtime. So if something goes wrong, you'll
most probably receive an appropriate error message.

=head1 BUGS

If you find any bugs, Tie::Hash::Indexed doesn't seem to
build on your system or any of its tests fail, please use
the CPAN Request Tracker at L<http://rt.cpan.org/> to create
a ticket for the module. Alternatively, just send a mail
to E<lt>mhx@cpan.orgE<gt>.

=head1 TODO

If you're interested in what I currently plan to improve
(or fix), have a look at the F<TODO> file.

=head1 COPYRIGHT

Copyright (c) 2003 Marcus Holland-Moritz. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 SEE ALSO

See L<perltie> and L<Tie::IxHash>.

=cut