/usr/share/perl5/Email/MIME/Header.pm is in libemail-mime-perl 1.910-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | use strict;
use warnings;
package Email::MIME::Header;
use base 'Email::Simple::Header';
our $VERSION = '1.910';
use Encode 1.9801;
=head1 NAME
Email::MIME::Header - the header of a MIME message
=head1 DESCRIPTION
This object behaves like a standard Email::Simple header, with the following
changes:
=over 4
=item * the C<header> method automatically decodes encoded headers if possible
=item * the C<header_raw> method returns the raw header; (read only for now)
=item * stringification uses C<header_raw> rather than C<header>
=back
Note that C<header_set> does not do encoding for you, and expects an
encoded header. Thus, C<header_set> round-trips with C<header_raw>,
not C<header>! Be sure to properly encode your headers with
C<Encode::encode('MIME-Header', $value)> before passing them to
C<header_set>.
Alternately, if you have Unicode (character) strings to set in headers, use the
C<header_str_set> method.
=cut
sub header {
my $self = shift;
my @header = $self->SUPER::header(@_);
local $@;
foreach my $header (@header) {
next unless $header =~ /=\?/;
$header = $self->_header_decode_str($header);
}
return wantarray ? (@header) : $header[0];
}
sub header_raw {
Carp::croak "header_raw may not be used to set headers" if @_ > 2;
my ($self, $header) = @_;
return $self->SUPER::header($header);
}
sub header_str_set {
my ($self, $name, @vals) = @_;
my @values = map { Encode::encode('MIME-Q', $_, 1) } @vals;
$self->header_set($name => @values);
}
sub _header_decode_str {
my ($self, $str) = @_;
my $new_str;
$new_str = $str
unless eval { $new_str = Encode::decode("MIME-Header", $str); 1 };
return $new_str;
}
=head1 COPYRIGHT
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 perl itself.
=cut
1;
|