Initial Commit

This commit is contained in:
Riley Schneider
2025-12-03 16:38:10 +01:00
parent c5e26bf594
commit b732d8d4b5
17680 changed files with 5977495 additions and 2 deletions

View File

@@ -0,0 +1,87 @@
use strict;
use warnings;
package Email::Abstract::EmailMIME;
# ABSTRACT: Email::Abstract wrapper for Email::MIME
$Email::Abstract::EmailMIME::VERSION = '3.008';
use Email::Abstract::EmailSimple;
BEGIN { @Email::Abstract::EmailMIME::ISA = 'Email::Abstract::EmailSimple' };
sub target { "Email::MIME" }
sub construct {
require Email::MIME;
my ($class, $rfc822) = @_;
Email::MIME->new($rfc822);
}
sub get_body {
my ($class, $obj) = @_;
# Return the same thing you'd get from Email::Simple.
#
# Ugh. -- rjbs, 2014-12-27
return $obj->body_raw;
}
1;
#pod =head1 DESCRIPTION
#pod
#pod This module wraps the Email::MIME mail handling library with an
#pod abstract interface, to be used with L<Email::Abstract>
#pod
#pod =head1 SEE ALSO
#pod
#pod L<Email::Abstract>, L<Email::MIME>.
#pod
#pod =cut
__END__
=pod
=encoding UTF-8
=head1 NAME
Email::Abstract::EmailMIME - Email::Abstract wrapper for Email::MIME
=head1 VERSION
version 3.008
=head1 DESCRIPTION
This module wraps the Email::MIME mail handling library with an
abstract interface, to be used with L<Email::Abstract>
=head1 SEE ALSO
L<Email::Abstract>, L<Email::MIME>.
=head1 AUTHORS
=over 4
=item *
Ricardo SIGNES <rjbs@cpan.org>
=item *
Simon Cozens <simon@cpan.org>
=item *
Casey West <casey@geeknest.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2004 by Simon Cozens.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut

View File

@@ -0,0 +1,103 @@
use strict;
use warnings;
package Email::Abstract::EmailSimple;
# ABSTRACT: Email::Abstract wrapper for Email::Simple
$Email::Abstract::EmailSimple::VERSION = '3.008';
use Email::Abstract::Plugin;
BEGIN { @Email::Abstract::EmailSimple::ISA = 'Email::Abstract::Plugin' };
sub target { "Email::Simple" }
sub construct {
require Email::Simple;
my ($class, $rfc822) = @_;
Email::Simple->new($rfc822);
}
sub get_header {
my ($class, $obj, $header) = @_;
$obj->header($header);
}
sub get_body {
my ($class, $obj) = @_;
$obj->body();
}
sub set_header {
my ($class, $obj, $header, @data) = @_;
$obj->header_set($header, @data);
}
sub set_body {
my ($class, $obj, $body) = @_;
$obj->body_set($body);
}
sub as_string {
my ($class, $obj) = @_;
$obj->as_string();
}
1;
#pod =head1 DESCRIPTION
#pod
#pod This module wraps the Email::Simple mail handling library with an
#pod abstract interface, to be used with L<Email::Abstract>
#pod
#pod =head1 SEE ALSO
#pod
#pod L<Email::Abstract>, L<Email::Simple>.
#pod
#pod =cut
__END__
=pod
=encoding UTF-8
=head1 NAME
Email::Abstract::EmailSimple - Email::Abstract wrapper for Email::Simple
=head1 VERSION
version 3.008
=head1 DESCRIPTION
This module wraps the Email::Simple mail handling library with an
abstract interface, to be used with L<Email::Abstract>
=head1 SEE ALSO
L<Email::Abstract>, L<Email::Simple>.
=head1 AUTHORS
=over 4
=item *
Ricardo SIGNES <rjbs@cpan.org>
=item *
Simon Cozens <simon@cpan.org>
=item *
Casey West <casey@geeknest.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2004 by Simon Cozens.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut

View File

@@ -0,0 +1,100 @@
use strict;
package Email::Abstract::MIMEEntity;
# ABSTRACT: Email::Abstract wrapper for MIME::Entity
$Email::Abstract::MIMEEntity::VERSION = '3.008';
use Email::Abstract::Plugin;
BEGIN { @Email::Abstract::MIMEEntity::ISA = 'Email::Abstract::MailInternet' };
my $is_avail;
sub is_available {
return $is_avail if defined $is_avail;
eval { require MIME::Entity; MIME::Entity->VERSION(5.501); 1 };
return $is_avail = $@ ? 0 : 1;
}
sub target { "MIME::Entity" }
sub construct {
require MIME::Parser;
my $parser = MIME::Parser->new;
$parser->output_to_core(1);
my ($class, $rfc822) = @_;
$parser->parse_data($rfc822);
}
sub get_body {
my ($self, $obj) = @_;
my $handle = $obj->bodyhandle;
return $handle ? $handle->as_string : join('', @{ $obj->body });
}
sub set_body {
my ($class, $obj, $body) = @_;
my @lines = split /\n/, $body;
my $io = $obj->bodyhandle->open("w");
foreach (@lines) { $io->print($_."\n") }
$io->close;
}
1;
#pod =head1 DESCRIPTION
#pod
#pod This module wraps the MIME::Entity mail handling library with an
#pod abstract interface, to be used with L<Email::Abstract>
#pod
#pod =head1 SEE ALSO
#pod
#pod L<Email::Abstract>, L<MIME::Entity>.
#pod
#pod =cut
__END__
=pod
=encoding UTF-8
=head1 NAME
Email::Abstract::MIMEEntity - Email::Abstract wrapper for MIME::Entity
=head1 VERSION
version 3.008
=head1 DESCRIPTION
This module wraps the MIME::Entity mail handling library with an
abstract interface, to be used with L<Email::Abstract>
=head1 SEE ALSO
L<Email::Abstract>, L<MIME::Entity>.
=head1 AUTHORS
=over 4
=item *
Ricardo SIGNES <rjbs@cpan.org>
=item *
Simon Cozens <simon@cpan.org>
=item *
Casey West <casey@geeknest.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2004 by Simon Cozens.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut

View File

@@ -0,0 +1,118 @@
use strict;
package Email::Abstract::MailInternet;
# ABSTRACT: Email::Abstract wrapper for Mail::Internet
$Email::Abstract::MailInternet::VERSION = '3.008';
use Email::Abstract::Plugin;
BEGIN { @Email::Abstract::MailInternet::ISA = 'Email::Abstract::Plugin' };
sub target { "Mail::Internet" }
# We need 1.77 because otherwise headers unfold badly.
my $is_avail;
sub is_available {
return $is_avail if defined $is_avail;
require Mail::Internet;
eval { Mail::Internet->VERSION(1.77) };
return $is_avail = $@ ? 0 : 1;
}
sub construct {
require Mail::Internet;
my ($class, $rfc822) = @_;
Mail::Internet->new([ map { "$_\x0d\x0a" } split /\x0d\x0a/, $rfc822]);
}
sub get_header {
my ($class, $obj, $header) = @_;
my @values = $obj->head->get($header);
return unless @values;
# No reason to s/// lots of values if we're just going to return one.
$#values = 0 if not wantarray;
chomp @values;
s/(?:\x0d\x0a|\x0a\x0d|\x0a|\x0d)\s+/ /g for @values;
return wantarray ? @values : $values[0];
}
sub get_body {
my ($class, $obj) = @_;
join "", @{$obj->body()};
}
sub set_header {
my ($class, $obj, $header, @data) = @_;
my $count = 0;
$obj->head->replace($header, shift @data, ++$count) while @data;
}
sub set_body {
my ($class, $obj, $body) = @_;
$obj->body( map { "$_\n" } split /\n/, $body );
}
sub as_string { my ($class, $obj) = @_; $obj->as_string(); }
1;
#pod =head1 DESCRIPTION
#pod
#pod This module wraps the Mail::Internet mail handling library with an
#pod abstract interface, to be used with L<Email::Abstract>
#pod
#pod =head1 SEE ALSO
#pod
#pod L<Email::Abstract>, L<Mail::Internet>.
#pod
#pod =cut
__END__
=pod
=encoding UTF-8
=head1 NAME
Email::Abstract::MailInternet - Email::Abstract wrapper for Mail::Internet
=head1 VERSION
version 3.008
=head1 DESCRIPTION
This module wraps the Mail::Internet mail handling library with an
abstract interface, to be used with L<Email::Abstract>
=head1 SEE ALSO
L<Email::Abstract>, L<Mail::Internet>.
=head1 AUTHORS
=over 4
=item *
Ricardo SIGNES <rjbs@cpan.org>
=item *
Simon Cozens <simon@cpan.org>
=item *
Casey West <casey@geeknest.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2004 by Simon Cozens.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut

View File

@@ -0,0 +1,103 @@
use strict;
package Email::Abstract::MailMessage;
# ABSTRACT: Email::Abstract wrapper for Mail::Message
$Email::Abstract::MailMessage::VERSION = '3.008';
use Email::Abstract::Plugin;
BEGIN { @Email::Abstract::MailMessage::ISA = 'Email::Abstract::Plugin' };
sub target { "Mail::Message" }
sub construct {
require Mail::Message;
my ($class, $rfc822) = @_;
Mail::Message->read($rfc822);
}
sub get_header {
my ($class, $obj, $header) = @_;
$obj->head->get($header);
}
sub get_body {
my ($class, $obj) = @_;
$obj->decoded->string;
}
sub set_header {
my ($class, $obj, $header, @data) = @_;
$obj->head->delete($header);
$obj->head->add($header, $_) for @data;
}
sub set_body {
my ($class, $obj, $body) = @_;
$obj->body(Mail::Message::Body->new(data => $body));
}
sub as_string {
my ($class, $obj) = @_;
$obj->string;
}
1;
#pod =head1 DESCRIPTION
#pod
#pod This module wraps the Mail::Message mail handling library with an
#pod abstract interface, to be used with L<Email::Abstract>
#pod
#pod =head1 SEE ALSO
#pod
#pod L<Email::Abstract>, L<Mail::Message>.
#pod
#pod =cut
__END__
=pod
=encoding UTF-8
=head1 NAME
Email::Abstract::MailMessage - Email::Abstract wrapper for Mail::Message
=head1 VERSION
version 3.008
=head1 DESCRIPTION
This module wraps the Mail::Message mail handling library with an
abstract interface, to be used with L<Email::Abstract>
=head1 SEE ALSO
L<Email::Abstract>, L<Mail::Message>.
=head1 AUTHORS
=over 4
=item *
Ricardo SIGNES <rjbs@cpan.org>
=item *
Simon Cozens <simon@cpan.org>
=item *
Casey West <casey@geeknest.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2004 by Simon Cozens.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut

View File

@@ -0,0 +1,65 @@
use strict;
use warnings;
package Email::Abstract::Plugin;
# ABSTRACT: a base class for Email::Abstract plugins
$Email::Abstract::Plugin::VERSION = '3.008';
#pod =method is_available
#pod
#pod This method returns true if the plugin should be considered available for
#pod registration. Plugins that return false from this method will not be
#pod registered when Email::Abstract is loaded.
#pod
#pod =cut
sub is_available { 1 }
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Email::Abstract::Plugin - a base class for Email::Abstract plugins
=head1 VERSION
version 3.008
=head1 METHODS
=head2 is_available
This method returns true if the plugin should be considered available for
registration. Plugins that return false from this method will not be
registered when Email::Abstract is loaded.
=head1 AUTHORS
=over 4
=item *
Ricardo SIGNES <rjbs@cpan.org>
=item *
Simon Cozens <simon@cpan.org>
=item *
Casey West <casey@geeknest.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2004 by Simon Cozens.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut