Permalink
Browse files

Book->authors_ids

  • Loading branch information...
1 parent 46c3b38 commit 811eaecbb7cd31008dbe3fe9e9a8e01e1871fb7a @moritz committed Jun 22, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/WebService/Libris/Book.pm
@@ -14,6 +14,7 @@ sub fragments {
sub related_books { shift->collection_from_dom('frbr_related') }
sub held_by { shift->collection_from_dom('held_by') }
sub authors_obj { shift->collection_from_dom('creator') }
+
sub authors_text {
my $self = shift;
my @authors = grep length, map $_->text, $self->dom->find('creator')->each;
@@ -27,6 +28,18 @@ sub authors_text {
}
}
+sub authors_ids {
+ my $self = shift;
+ my %seen;
+ my @ids = sort
+ grep { !$seen{$_}++ }
+ map { (split '/', $_)[-1] }
+ grep $_,
+ map { $_->attrs->{'rdf:resource'} }
+ $self->dom->find('creator')->each;
+ return @ids;
+}
+
sub language {
my $self = shift;
my $l = $self->dom->at('language');

0 comments on commit 811eaec

Please sign in to comment.