App-SpreadRevolutionaryDate
view release on metacpan or search on metacpan
lib/App/SpreadRevolutionaryDate/Target.pm view on Meta::CPAN
#
# This file is part of App-SpreadRevolutionaryDate
#
# This software is Copyright (c) 2019-2026 by Gérald Sédrati.
#
# This is free software, licensed under:
#
# The GNU General Public License, Version 3, June 2007
#
use 5.014;
use utf8;
package App::SpreadRevolutionaryDate::Target;
$App::SpreadRevolutionaryDate::Target::VERSION = '0.54';
# ABSTRACT: Role providing interface for targets of L<App::SpreadRevolutionaryDate>.
use MooseX::Role::Parameterized;
use LWP::Protocol::https;
use Locale::TextDomain 'App-SpreadRevolutionaryDate';
use namespace::autoclean;
parameter worker => (
isa => 'Str',
default => 'Any',
);
role {
my $p = shift;
has obj => (
is => 'ro',
isa => $p->worker,
required => 1,
);
requires 'spread';
};
sub _split_msg {
my ($self, $text, $max_len) = @_;
my @msgs;
while ($text) {
if (length $text <= $max_len) {
push @msgs, $text;
last;
}
my $prefix = substr $text, 0, $max_len;
my $loc = rindex $prefix, ' ';
if ($loc == -1) {
die "We found a word which is longer than $max_len\n";
}
my $str = substr $text, 0, $loc, '';
push @msgs, $str;
substr $text, 0, 1, '';
}
return @msgs;
}
# A module must return a true value. Traditionally, a module returns 1.
# But this module is a revolutionary one, so it discards all old traditions.
# Idea borrowed from Jean Forget's DateTime::Calendar::FrenchRevolutionary.
"Quand le gouvernement viole les droits du peuple,
l'insurrection est pour le peuple le plus sacré
et le plus indispensable des devoirs";
__END__
=pod
=encoding UTF-8
=head1 NAME
App::SpreadRevolutionaryDate::Target - Role providing interface for targets of L<App::SpreadRevolutionaryDate>.
=head1 VERSION
version 0.54
( run in 0.928 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )