/usr/share/perl5/Biber/Annotation.pm is in biber 2.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | package Biber::Annotation;
use v5.24;
use strict;
use warnings;
use Biber::Config;
use Biber::Constants;
use Data::Dump;
use Biber::Utils;
use Log::Log4perl qw( :no_extra_logdie_message );
use List::Util qw( first );
no autovivification;
my $logger = Log::Log4perl::get_logger('main');
# Static class data
my $ANN = {};
=encoding utf-8
=head1 ANNOTATION
Biber::Entry::Annotation
=head2 set_annotation
Record an annotation for a scope and citekey
=cut
sub set_annotation {
shift; # class method so don't care about class name
my ($scope, $key, $field, $value, $count, $part) = @_;
if ($scope eq 'field') {
$ANN->{field}{$key}{$field} = $value;
}
elsif ($scope eq 'item') {
$ANN->{item}{$key}{$field}{$count} = $value;
}
elsif ($scope eq 'part') {
$ANN->{part}{$key}{$field}{$count}{$part} = $value;
}
# For easy checking later whether or not a field is annotated
$ANN->{fields}{$key}{$field} = 1;
return;
}
=head2 get_annotation
Retrieve an annotation for a scope and citekey
=cut
sub get_annotation {
shift; # class method so don't care about class name
my ($scope, $key, $field, $count, $part) = @_;
if ($scope eq 'field') {
return $ANN->{field}{$key}{$field};
}
elsif ($scope eq 'item') {
return $ANN->{item}{$key}{$field}{$count};
}
elsif ($scope eq 'part') {
return $ANN->{part}{$key}{$field}{$count}{$part};
}
return undef;
}
=head2 is_annotated_field
Returns boolean to say if a field is annotated
=cut
sub is_annotated_field {
shift; # class method so don't care about class name
my ($key, $field) = @_;
return $ANN->{fields}{$key}{$field};
}
=head2 get_field_annotation
Retrieve 'field' scope annotation for a field. There will only be one.
=cut
sub get_field_annotation {
shift; # class method so don't care about class name
my ($key, $field) = @_;
return $ANN->{field}{$key}{$field};
}
=head2 get_annotated_fields
Retrieve all annotated fields for a particular scope for a key
=cut
sub get_annotated_fields {
shift; # class method so don't care about class name
my ($scope, $key) = @_;
return sort keys $ANN->{$scope}{$key}->%*;
}
=head2 get_annotated_items
Retrieve the itemcounts for for a particular scope, key and field
=cut
sub get_annotated_items {
shift; # class method so don't care about class name
my ($scope, $key, $field) = @_;
return sort keys $ANN->{$scope}{$key}{$field}->%*;
}
=head2 get_annotated_parts
Retrieve the parts for for a particular scope, key, field and itemcount
=cut
sub get_annotated_parts {
shift; # class method so don't care about class name
my ($scope, $key, $field, $count) = @_;
return sort keys $ANN->{$scope}{$key}{$field}{$count}->%*;
}
=head2 dump
Dump config information (for debugging)
=cut
sub dump {
shift; # class method so don't care about class name
dd($ANN);
}
1;
__END__
=head1 AUTHORS
François Charette, C<< <firmicus at ankabut.net> >>
Philip Kime C<< <philip at kime.org.uk> >>
=head1 BUGS
Please report any bugs or feature requests on our Github tracker at
L<https://github.com/plk/biber/issues>.
=head1 COPYRIGHT & LICENSE
Copyright 2009-2017 François Charette and Philip Kime, all rights reserved.
This module is free software. You can redistribute it and/or
modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
=cut
|