App-CPRReporter
view release on metacpan or search on metacpan
lib/App/CPRReporter.pm view on Meta::CPAN
use strict;
use warnings;
package App::CPRReporter 0.02;
$App::CPRReporter::VERSION = '0.03';
use Moose;
use namespace::autoclean;
use 5.012;
use autodie;
use Carp qw/croak carp/;
use Text::ResusciAnneparser;
use Spreadsheet::XLSX;
use Text::Iconv;
use Data::Dumper;
use Text::Fuzzy::PP;
has employees => (
is => 'ro',
isa => 'Str',
required => 1,
);
has certificates => (
is => 'ro',
isa => 'Str',
required => 1,
);
has course => (
is => 'ro',
isa => 'Str',
required => 1,
);
# Actions that need to be run after the constructor
sub BUILD {
my $self = shift;
# Add stuff here
my $certparser =
Text::ResusciAnneparser->new( infile => $self->{certificates} );
$self->{_certificates} = $certparser->certified();
$self->{_training} = $certparser->in_training();
$self->_parse_employees;
# Make an array of employees that will be used for fuzzy matching
foreach my $employee ( keys %{$self->{_employees}} ) {
push( @{ $self->{_employee_array} }, $employee );
}
#print Dumper($self->{_employee_array});
# Only parse the course info after the array is created, the array is used in matching
$self->_parse_course;
}
# Run the application, merging the info of the certificates and the employees
sub run {
my $self = shift;
# Certificates are here
my $certificate_count = 0;
my $certs = $self->{_certificates};
foreach my $date ( sort keys %{$certs} ) {
foreach my $certuser ( @{ $certs->{$date} } ) {
my $fullname = $self->_resolve_name( $certuser->{familyname},
$certuser->{givenname} );
#say "Certificate found for $fullname";
$certificate_count++;
( run in 1.329 second using v1.01-cache-2.11-cpan-39bf76dae61 )