#!/usr/bin/perl
use warnings;
use strict;

use lib '../lib';
use Devel::Size qw(size total_size);
use List::Util 'sum';

use Mail::Box::Manager;
my $mgr    = Mail::Box::Manager->new;
my $folder = $mgr->open('a3', lock_method => 'NONE');

my $msg = $folder->message(0) or die;
my $head = $msg->head;
my $body = $msg->body;

my @fields = $head->orderedFields;
print "Head", $head->size,", ", $head->nrLines, ", ".@fields, "\n";
print "Msg", $msg->size, "\n";

$msg->folder(undef);
print "MEM MSG: ", total_size($msg), "\n";

#$head->{MMH_order} = [ (undef) x @{$head->{MMH_order}} ];
$head->message(undef);

my @l = $body->lines;
$body->message(undef);
warn %$body;

#$msg->body(undef);

print "MEM HEAD: ", total_size($head), "\n";
print "MEM BODY: ", total_size($body), "\n";
#$head->print;

