OpenSSL-Query, QueryApp: Add methods to get the list of identities
authorRichard Levitte <richard@levitte.org>
Wed, 14 Jun 2017 12:10:59 +0000 (14:10 +0200)
committerRichard Levitte <richard@levitte.org>
Wed, 14 Jun 2017 12:10:59 +0000 (14:10 +0200)
lib/OpenSSL/Query/PersonDB.pm

index 4d9ede35852544bc6ffc44be17ff3ac57134ceb6..ab5507b810161b1c27f4a55912608b211f3c5a7f 100644 (file)
@@ -12,6 +12,7 @@ use strict;
 package OpenSSL::Query::PersonDB;
 
 use Carp;
+use Clone qw(clone);
 use Moo;
 use OpenSSL::Query qw(-register-person OpenSSL::Query::PersonDB -priority 0);
 
@@ -38,6 +39,17 @@ sub _build__persondb {
   return $yaml;
 }
 
+sub list_people {
+  my $self = shift;
+
+  my @list = ();
+  foreach my $record (@{$self->_persondb}) {
+    push @list, clone($record->{ids});
+  }
+
+  return @list;
+}
+
 sub find_person {
   my $self = shift;
   my $id = shift;