Koha-Contrib-Sudoc

 view release on metacpan or  search on metacpan

lib/Koha/Contrib/Sudoc/Loader.pm  view on Meta::CPAN

package Koha::Contrib::Sudoc::Loader;
# ABSTRACT: Classe de base pour le chargement de notices biblio/autorité
$Koha::Contrib::Sudoc::Loader::VERSION = '2.49';
use Moose;
use Modern::Perl;
use utf8;
use MARC::Moose::Reader::File::Iso2709;
use Koha::Contrib::Sudoc::Converter;
use Log::Dispatch;
use Log::Dispatch::Screen;
use Log::Dispatch::File;
use Class::Load ':all';
use DateTime;


# Moulinette SUDOC
has sudoc => ( is => 'rw', isa => 'Koha::Contrib::Sudoc', required => 1 );

# Fichier des notices biblios/autorités
has file => ( is => 'rw', isa => 'Str', required => 1 );

# Chargement effectif ?
has doit => ( is => 'rw', isa => 'Bool', default => 0 );

# Compteur d'enregistrements traités
has count => (  is => 'rw', isa => 'Int', default => 0 );

# Compteur d'enregistrements ajoutés
has count_added => (  is => 'rw', isa => 'Int', default => 0 );

# Compteur d'enregistrements remplacés
has count_replaced => (  is => 'rw', isa => 'Int', default => 0 );

# Compteur d'enregistrements non traités
has count_skipped => ( is => 'rw', isa => 'Int', default => 0 );

# Converter
has converter => (
    is      => 'rw',
    isa     => 'Koha::Contrib::Sudoc::Converter',
);

# Le logger
has log => (
    is => 'rw',
    isa => 'Log::Dispatch',
    default => sub { Log::Dispatch->new() },
);


sub BUILD {
    my $self = shift;

    my $id = ref($self);
    ($id) = $id =~ /.*:(.*)$/;

    $self->log->add( Log::Dispatch::Screen->new(
        name      => 'screen',
        min_level => 'notice',
        stderr    => 0,
    ) );
    binmode(STDOUT, ':encoding(utf8)');
    $self->log->add( Log::Dispatch::File->new(
        name      => 'file1',
        min_level => 'debug',



( run in 1.352 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )