ody = new MIME::Body::Scalar "Line 1\nLine 2\nLine 3";

A single array reference sets the body to the result of joining all the
elements of that array together:

    $body = new MIME::Body::Scalar ["Line 1\n",
                                    "Line 2\n",
                                    "Line 3"];

=cut

use vars qw(@ISA);
use strict;

use Carp;

@ISA = qw(MIME::Body);


#------------------------------
# init DATA
#------------------------------
sub init {
    my ($self, $data) = @_;
    $data = join('', @$data)    if (ref($data) && (ref($data) eq 'ARRAY'));
    $self->{MBS_Data} = (defined($data) ? $data : '');
    $self;
}

#------------------------------
# as_string
#------------------------------
sub as_string {
    shift->{MBS_Data};
}

#------------------------------
# open READWRITE
#------------------------------
sub open {
    my ($self, $mode) = @_;
    $self->{MBS_Data} = '' if ($mode eq 'w');        ### writing

    if ($mode eq 'w') {
	    $mode = '>:';
    } elsif ($mode eq 'r') {
	    $mode = '<:';
    } else {
	    die "bad mode: $mode";
    }

    return IO::File->new(\ $self->{MBS_Data}, $mode);
}



