Koha-Contrib-Tamil
view release on metacpan or search on metacpan
lib/Koha/Contrib/Tamil/Authority/FromFile.pm view on Meta::CPAN
package Koha::Contrib::Tamil::Authority::FromFile;
# ABSTRACT: Find Koha authorities from an ISO2709 file
$Koha::Contrib::Tamil::Authority::FromFile::VERSION = '0.074';
use Moose;
extends qw/ AnyEvent::Processor
Koha::Contrib::Tamil::Logger /;
use Modern::Perl;
use utf8;
use FindBin qw( $Bin );
use Carp;
use YAML;
use Koha::Contrib::Tamil::Koha;
use MARC::Moose::Reader::File::Marcxml;
use MARC::Moose::Formater::Marcxml;
use MARC::Moose::Formater::Text;
use MARC::Moose::Parser::Iso2709;
use YAML qw/Dump LoadFile/ ;
use Try::Tiny;
has koha => ( is => 'rw', isa => 'Koha::Contrib::Tamil::Koha' );
has reader => ( is => 'rw', isa => 'MARC::Moose::Reader' );
has writer => ( is => 'rw', isa => 'MARC::Moose::Writer' );
has authority => (
is => 'rw',
isa => 'Str',
required => 1,
trigger => sub {
my ($self, $name) = @_;
#FIXME: Le fichier des autorités est écrasé
# On pourrait le signaler.
#croak "Le fichier des autorités existe déjà : ", $name if $name;
open my $fh, ">", $name or croak "Impossible de créer le fichier $name";
binmode($fh, ':utf8');
$self->authority_writer( $fh );
return $name;
},
);
has authority_writer => ( is => 'rw' );
# Le cache des autorités déjà trouvées
# Un ref à un tableau à deux dimensions :
# 0: l'autorité principale
# 1: l'autorité non vedette
has cache_auth => (
is => 'rw',
isa => 'ArrayRef',
default => sub {
[ {}, {} ]
}
);
has use_cache_auth => (is => 'rw', isa => 'Bool', default => '1');
has equivalence => (
is => 'rw',
isa => 'Str',
trigger => sub {
my ($self, $name) = @_;
( run in 1.002 second using v1.01-cache-2.11-cpan-0d23b851a93 )