| 1 |
package DNS::LDNS::KeyList; |
| 2 |
|
| 3 |
use 5.008008; |
| 4 |
use strict; |
| 5 |
use warnings; |
| 6 |
|
| 7 |
use DNS::LDNS ':all'; |
| 8 |
|
| 9 |
our $VERSION = '0.61'; |
| 10 |
|
| 11 |
sub new { |
| 12 |
my $class = shift; |
| 13 |
|
| 14 |
return _new(); |
| 15 |
} |
| 16 |
|
| 17 |
sub push { |
| 18 |
my ($self, @keys) = @_; |
| 19 |
|
| 20 |
for my $k (@keys) { |
| 21 |
if (DNS::LDNS::GC::is_owned($k)) { |
| 22 |
die "Cannot push a key on multiple lists."; |
| 23 |
} |
| 24 |
$self->_push($k); |
| 25 |
DNS::LDNS::GC::own($k, $self); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
sub key { |
| 30 |
my ($self, $index) = @_; |
| 31 |
return DNS::LDNS::GC::own($self->_key($index), $self); |
| 32 |
} |
| 33 |
|
| 34 |
sub DESTROY { |
| 35 |
DNS::LDNS::GC::free($_[0]); |
| 36 |
} |
| 37 |
|
| 38 |
1; |
| 39 |
__END__ |
| 40 |
|
| 41 |
=head1 NAME |
| 42 |
|
| 43 |
DNS::LDNS::KeyList - Linked list of dnssec keys |
| 44 |
|
| 45 |
=head1 SYNOPSIS |
| 46 |
|
| 47 |
use DNS::LDNS ':all' |
| 48 |
|
| 49 |
my l = new DNS::LDNS::KeyList |
| 50 |
l->set_use(bool) |
| 51 |
l->push(@keys) |
| 52 |
key = l->pop |
| 53 |
c = l->count |
| 54 |
key = l->key(index) |
| 55 |
|
| 56 |
=head1 SEE ALSO |
| 57 |
|
| 58 |
http://www.nlnetlabs.nl/projects/ldns |
| 59 |
|
| 60 |
=head1 AUTHOR |
| 61 |
|
| 62 |
Erik Pihl Ostlyngen, E<lt>[email protected]<gt> |
| 63 |
|
| 64 |
=head1 COPYRIGHT AND LICENSE |
| 65 |
|
| 66 |
Copyright (C) 2013 by UNINETT Norid AS |
| 67 |
|
| 68 |
This library is free software; you can redistribute it and/or modify |
| 69 |
it under the same terms as Perl itself, either Perl version 5.14.2 or, |
| 70 |
at your option, any later version of Perl 5 you may have available. |
| 71 |
|
| 72 |
=cut |