Business-CAMT
view release on metacpan or search on metacpan
lib/Business/CAMT.pm view on Meta::CPAN
# This code is part of Perl distribution Business-CAMT version 0.16.
# The POD got stripped from this file by OODoc version 3.06.
# For contributors see file ChangeLog.
# This software is copyright (c) 2024-2026 by Mark Overmeer.
# This is free software; you can redistribute it and/or modify it under
# the same terms as the Perl 5 programming language system itself.
# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
# https://www.betaalvereniging.nl/wp-content/uploads/IG-Bank-to-Customer-Statement-CAMT-053-v1-1.pdf
package Business::CAMT;{
our $VERSION = '0.16';
}
use strict;
use warnings;
use utf8;
use Log::Report 'business-camt';
use Path::Class ();
use XML::LibXML ();
use XML::Compile::Cache ();
use Scalar::Util qw/blessed/;
use List::Util qw/first/;
use XML::Compile::Util qw/pack_type/;
use Business::CAMT::Message ();
my $urnbase = 'urn:iso:std:iso:20022:tech:xsd';
my $moddir = Path::Class::File->new(__FILE__)->dir;
my $xsddir = $moddir->subdir('CAMT', 'xsd');
my $tagdir = $moddir->subdir('CAMT', 'tags');
sub _rootElement($) { pack_type $_[1], 'Document' } # $ns parameter
# The XSD filename is like camt.052.001.12.xsd. camt.052.001.* is
# expected to be incompatible with camt.052.002.*, but *.12.xsd can
# usually parse *.11.xsd
my %xsd_files;
# Translations from abbreviated XML tags to longer names, loaded on
# demand.
my $tagtable;
sub new(%)
{ my ($class, %args) = @_;
(bless {}, $class)->init(\%args);
}
sub init($)
{ my ($self, $args) = @_;
# Collect the names of all CAMT schemes in this distribution
foreach my $f (grep !$_->is_dir && $_->basename =~ /\.xsd$/, $xsddir->children)
{ $f->basename =~ /^camt\.([0-9]{3}\.[0-9]{3})\.([0-9]+)\.xsd$/ or panic $f;
$xsd_files{$1}{$2} = $f->stringify;
}
$self->{BC_rule} = delete $args->{match_schema} || 'NEWER';
$self->{BC_big} = delete $args->{big_numbers} || 0;
$self->{BC_long} = delete $args->{long_tagnames} || 0;
$self->{RC_schemas} = XML::Compile::Cache->new;
$self;
}
#--------------------
( run in 2.483 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )