Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi

Who's eating the eol? At this point I'm willing to blame the dog, but if anybody could point me toward a more likely suspect, I would greatly appreciate it. As would the dog.

Start with Basic debugging checklist

Also don't write your program in between subroutine declarations

As you can see no newlines are missing

#!/usr/bin/perl -- use strict; use warnings; use MIME::Lite; use Data::Dump qw/ dd /; my $source_heart_beat_timestamp = ''; my $target_heart_beat_timestamp = ''; $source_heart_beat_timestamp = "foo"; $target_heart_beat_timestamp = "bar"; my $output_msg = "Source Heart Beat TimeStamp: " . $source_heart_beat_timestamp . "\n +"; $output_msg .= "Target Heart Beat TimeStamp: $target_heart_beat_timest +amp"; local_do_mail("local_do_mail:\n$output_msg"); $source_heart_beat_timestamp = "20171207_113255"; $target_heart_beat_timestamp = "bar"; $output_msg = "Source Heart Beat TimeStamp: " . $source_heart_beat_timestamp . "\n +"; $output_msg .= "Target Heart Beat TimeStamp: $target_heart_beat_timest +amp"; local_do_mail("local_do_mail:\n$output_msg"); exit 0; sub local_do_mail { my ($msg_body) = @_; my $msg = MIME::Lite->new( From => 'cloudops@example.com', To => 'cbeckley@example.com', Subject => 'testing missing eol', Data => $msg_body ); #~ $msg->send; #~ $msg->print; dd( $msg->as_string ); } __END__ "Content-Disposition: inline\nContent-Transfer-Encoding: 8bit\nContent +-Type: text/plain\nMIME-Version: 1.0\nX-Mailer: MIME::Lite 3.029 (F2. +84; T2.04; A2.12; B3.14; Q3.13)\nDate: Fri, 8 Dec 2017 19:41:07 -0800 +\nFrom: cloudops\@example.com\nTo: cbeckley\@example.com\nSubject: te +sting missing eol\n\nlocal_do_mail:\nSource Heart Beat TimeStamp: foo +\nTarget Heart Beat TimeStamp: bar" "Content-Disposition: inline\nContent-Transfer-Encoding: 8bit\nContent +-Type: text/plain\nMIME-Version: 1.0\nX-Mailer: MIME::Lite 3.029 (F2. +84; T2.04; A2.12; B3.14; Q3.13)\nDate: Fri, 8 Dec 2017 19:41:07 -0800 +\nFrom: cloudops\@example.com\nTo: cbeckley\@example.com\nSubject: te +sting missing eol\n\nlocal_do_mail:\nSource Heart Beat TimeStamp: 201 +71207_113255\nTarget Heart Beat TimeStamp: bar"

Count the \n there are 2 in both messages

"local_do_mail:\nSource Heart Beat TimeStamp: foo\nTarget Heart Beat T +imeStamp: bar" "local_do_mail:\nSource Heart Beat TimeStamp: 20171207_113255\nTarget +Heart Beat TimeStamp: bar"

So who is to blame? The destination displaying the email body.


In reply to Re: Losing eol character using MIME::Lite by Anonymous Monk
in thread Losing eol character using MIME::Lite by cbeckley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-06-13 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.