Email-Simple

 view release on metacpan or  search on metacpan

lib/Email/Simple.pm  view on Meta::CPAN

  $arg ||= {};

  Carp::croak 'Unable to parse undefined message' if ! defined $text;

  my $text_ref = (ref $text || '' eq 'SCALAR') ? $text : \$text;

  Carp::carp 'Message with wide characters' if ${$text_ref} =~ /[^\x00-\xFF]/;

  my ($pos, $mycrlf) = $class->_split_head_from_body($text_ref);

  my $self = bless { mycrlf => $mycrlf } => $class;

  my $head;
  if (defined $pos) {
    $head = substr $$text_ref, 0, $pos, '';
    substr($head, -(length $mycrlf)) = '';
  } else {
    $head     = $$text_ref;
    $text_ref = \'';
  }

lib/Email/Simple/Header.pm  view on Meta::CPAN

  my $headers = $class->_header_to_list($head_ref, $self->{mycrlf});

  #  for my $header (@$headers) {
  #    push @{ $self->{order} }, $header->[0];
  #    push @{ $self->{head}{ $header->[0] } }, $header->[1];
  #  }
  #
  #  $self->{header_names} = { map { lc $_ => $_ } keys %{ $self->{head} } };
  $self->{headers} = $headers;

  bless $self => $class;
}

sub _header_to_list {
  my ($self, $head, $mycrlf) = @_;

  Carp::carp 'Header with wide characters' if ${$head} =~ /[^\x00-\xFF]/;

  my @headers;

  my $crlf = Email::Simple->__crlf_re;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.731 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )