in reply to Re^2: problem with Mail::Sender while sending email
in thread problem with Mail::Sender while sending email

Please check this code
->Part({ ctype => 'text/html', disposition => 'NONE', msg => <<'*END*'}) $var *END*

Replies are listed 'Best First'.
Re^4: problem with Mail::Sender while sending email
by james2vegas (Chaplain) on Aug 26, 2009 at 05:07 UTC
    You don't need a heredoc when you have the text in a variable already.

    use this instead
    ->Part({ ctype => 'text/html', disposition => 'NONE', msg => $var})
Re^4: problem with Mail::Sender while sending email
by Boldra (Curate) on Aug 28, 2009 at 12:55 UTC
    Look at this:
    $var = 'hello world'; print <<'END'; $var END
    and this
    $var = 'hello world'; print <<"END" $var END
    Assuming you really do want a 'heredoc' here, you want the second kind.

    Don't put stars in the heredoc terminator, that's ugly. If it doesn't stand out enough already, you need a different editor. END



    - Boldra

      Beauty is in the eye of the beer holder! I use the "*END*" all the time. Not just that it stands out more, but it's also less likely to appear in the stuff I'm quoting. And my editor does highlight the heredocs just fine, thank you.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        I was convinced I could counter with a rewrite of Chandanperl's code with a typo or two and get it to compile and produce something totally unexpected ( using an empty binary shift <<, a glob *END and the glob of $OFS, *, thrown up against the $var in the example), but I haven't managed it yet.

        This was the basis of my argument about the 'ugliness' of the terminator - if it looks enough like a completely different piece of valid perl, and you have to think for a moment to work out how it will be parsed, I call it ugly. Since I can't support my argument with a concrete example, I'll have to let you off - this time! :)

        Personally, I usually use a long string as a terminator, since I only have to type it twice.



        - Boldra