in reply to MIME::Lite truncating attachment

This is not an answer, but a question for anyone. What is happening here:

my $body = (); my $csv = '"';

in the above code? Wouldn't:

my ( $body, $csv );

suffice? Or is there some reason to declare the array ref $body if that is what's happening here? Thanks!

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re^2: MIME::Lite truncating attachment
by jethro (Monsignor) on Jul 01, 2008 at 14:24 UTC
    I first thought $body would be initialized to '0' as the size of the list similar to @b=(); $body=@b

    But $body gets initialized to the empty string. Seems (by running perl -D1 -e '$b=();') that () is interpreted as an empty term folding to a (wrong!?) boolean expression like $body=(1==0)

    my ( $body,$csv)=('','"'); would suffice, your code misses the initialization. If you run that without 'use strict' you won't get errors, but $csv is still missing the init to '"', so the first value in the $csv string would have no opening quotation mark

Re^2: MIME::Lite truncating attachment
by gcoates (Novice) on Jul 01, 2008 at 16:43 UTC
    Thanks for the tips, folks. I figured out what happened. The CGI module uses a null string (\0) to separate values in multi-valued parameters. Those nulls where choking the email program. Replacing the null strings with another separator fixed the problem.