<commit_before>#!/usr/bin/env perl
use strict;
use v5.14;
use strict;
use FindBin qw($Bin);
use lib "$Bin/../lib";
use lib "$Bin/../local/lib/perl5";
use Diversion::FeedArchiver;
use IO::All;
use Log::Dispatch;
use Log::Any::Adapter;
use Carp qw(cluck);

# $SIG{__DIE__} = sub { Carp::cluck(@_); exit };

my $feed_url = shift or die "Missing URL in arg";

my $log = Log::Dispatch->new(
    outputs => [
        [ 'File', min_level => "debug", filename => "/tmp/feed-archiver.pl" ],
        [ 'Screen', min_level => "debug" ],
    ]
);
Log::Any::Adapter->set('Dispatch', dispatcher => $log);

my @feeds;
if (-f $feed_url) {
    @feeds = grep { s/\s//g; $_ } io($feed_url)->chomp->getlines;
}
else {
    push @feeds, $feed_url;
}

for (@feeds) {
    eval {
        Diversion::FeedArchiver->new( url => $_ )->fetch_then_archive;
        1;
    } or do {
        say STDERR $@;
    };
}<commit_msg>log file name.<commit_after>#!/usr/bin/env perl
use strict;
use v5.14;
use strict;
use FindBin qw($Bin);
use lib "$Bin/../lib";
use lib "$Bin/../local/lib/perl5";
use Diversion::FeedArchiver;
use IO::All;
use Log::Dispatch;
use Log::Any::Adapter;
use Carp qw(cluck);

# $SIG{__DIE__} = sub { Carp::cluck(@_); exit };

my $feed_url = shift or die "Missing URL in arg";

my $log = Log::Dispatch->new(
    outputs => [
        [ 'File', min_level => "debug", filename => "/tmp/feed-archiver.log" ],
        [ 'Screen', min_level => "debug" ],
    ]
);
Log::Any::Adapter->set('Dispatch', dispatcher => $log);

my @feeds;
if (-f $feed_url) {
    @feeds = grep { s/\s//g; $_ } io($feed_url)->chomp->getlines;
}
else {
    push @feeds, $feed_url;
}

for (@feeds) {
    eval {
        Diversion::FeedArchiver->new( url => $_ )->fetch_then_archive;
        1;
    } or do {
        say STDERR $@;
    };
}
{'fraction_non_alphanumeric': 0.20726256983240224, 'fraction_numerical': 0.00558659217877095, 'mean_word_length': 3.1077981651376145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1161204', 'n_tokens_mistral': 703, 'n_tokens_neox': 687, 'n_words': 162}