project_conquer/scripts/fix_word.pl

27 lines
534 B
Perl

use strict;
use warnings;
use v5.36;
use Path::Tiny;
use MsOffice::Word::Surgeon;
use DDP;
use Try::Catch;
my $dir = path('/mnt/nasty/Koku/The Bakilanas');
my $iter = $dir->iterator;
while ( my $filepath = $iter->() ) {
if ($filepath->basename =~ /.docx?$/i) {
say $filepath;
open_file($filepath->stringify);
}
}
sub open_file($filename) {
try {
my $surgeon = MsOffice::Word::Surgeon->new(docx => $filename);
say "opens fine!";
}
catch {
say "couldn't open: $@";
}
}