1package Heap::Simple::XS; 2use strict; 3# use warnings; 4use vars qw($VERSION); 5 6$VERSION = "0.10"; 7 8require XSLoader; 9XSLoader::load('Heap::Simple::XS', $VERSION); 10 11sub implementation() { 12 return __PACKAGE__; 13} 14 151; 16__END__ 17 18=head1 NAME 19 20Heap::Simple::XS - An XS implementation of the Heap::Simple interface 21 22=head1 SYNOPSIS 23 24 # Let Heap::Simple decide which implementation that provides its interface 25 # it will load and use. This may be Heap::Simple::XS or it may not be. 26 # Still, this is the normal way of using Heap::Simple 27 use Heap::Simple; 28 my $heap = Heap::Simple->new(...); 29 # Use heap as described in the Heap::Simple documentation 30 31 # If for some reason you insist on using this version: 32 use Heap::Simple::XS; 33 my $heap = Heap::Simple::XS->new(...); 34 # Use the XS heap as described in the Heap::Simple documentation 35 36=head1 DESCRIPTION 37 38This module provides an XS implementation of the interface described 39in L<Heap::Simple|Heap::Simple>. Look there for a description. 40 41=head1 NOTES 42 43=over 44 45=item 46 47Even though this implementation is written in C, it fully supports 48overloading and magic (like L<ties|perltie>). 49 50=item 51 52The dirty option will do several things. 53 54=over 4 55 56=item 57 58It will cause scalars for the C<E<lt>> and C<E<gt>> orders 59to be stored internally as an NV (double or long double). This means you lose 60magic, overload and any internal integer representation. 61 62=item 63 64The C<E<lt>> and C<E<gt>> order will cause C<Array> and C<Hash> elements 65to get their key internally cached as an NV. So indirect changes to the value 66won't be noticed anymore (but most of the time you shouldn't do that anyways). 67It also means these will start behaving like a wrapped heap type, so they 68return true for L<wrapped|Heap::Simple/wrapped> and support 69L<key_insert|Heap::Simple/key_insert> and 70L<key_absorb|Heap::Simple/key_absorb>. 71 72=item 73 74The C<E<lt>> and C<E<gt>> order will cause C<Object> and C<Any> elements 75to store the key as an NV (these two already were wrapped heap types). 76 77=item 78 79It has no effect on C<Method> and C<Function> element types since it's 80assumed you B<want> the key recalculations for these for some reason (if you 81didn't, you would have asked for C<Object> or C<Any> elements). 82 83=back 84 85=item 86 87Heap::Simple->implementation will return C<"Heap::Simple::XS"> if it selected 88this module. 89 90=back 91 92=head1 EXPORT 93 94None. 95 96=head1 SEE ALSO 97 98L<Heap::Simple>, 99L<Heap::Simple::Perl> 100 101=head1 AUTHOR 102 103Ton Hospel, E<lt>Heap-Simple-XS@ton.iguana.beE<gt> 104 105Parts are inspired by code by Joseph N. Hall 106L<http://www.perlfaq.com/faqs/id/196> 107 108=head1 COPYRIGHT AND LICENSE 109 110Copyright (C) 2004 by Ton Hospel 111 112This library is free software; you can redistribute it and/or modify 113it under the same terms as Perl itself, either Perl version 5.6.1 or, 114at your option, any later version of Perl 5 you may have available. 115 116=cut 117