With this folder format:
Perl
Perl.sbd/search.cpan.org
Perl.sbd/rt.cpan.org
This code should return the number of messages in the subfolders of the foldername passed on the command line:
use Mail::Box::Manager;
my $mgr = Mail::Box::Manager->new;
my $flder = shift;
my $src = $mgr->open( folder => $flder, subfolder_extension => '.sbd', fix_headers => 1 );
for ($src->listSubFolders) {
my $x = $src->openSubFolder( $_ );
warn "$_ => ",
$src->nameOfSubFolder($_), ' => ',
scalar $x->messages, "\n";
}
$mgr->closeAllFolders;
but instead, I get something like this:
WARNING: Folder does not exist, failed opening mbox folder Perl/search.cpan.org.
Can't call method "messages" on an undefined value at ml2.pl line 7.
so listSubFolders successfully gets the folders in the Perl.sbd folder, but openSubFolder (and openRelatedFolder) do not honour the subfolder_extension option, renaming Perl.sbd to Perl.d results in expected behaviour:
search.cpan.org => Perl/search.cpan.org => 52089
rt.cpan.org => Perl/rt.cpan.org => 2928
also adding:
local $Mail::Box::Mbox::default_sub_extension = '.sbd';
in appropriate places works too.
It seems that sub Mail::Box::Mbox::folderToFilename doesn't get passed %args in $thingy, so this line:
$extension ||=
ref $thingy ? $thingy->{MBM_sub_ext} : $default_sub_extension;
only ever uses $default_sub_extension instead of $args{MBM_sub_ext}
Perl
Perl.sbd/search.cpan.org
Perl.sbd/rt.cpan.org
This code should return the number of messages in the subfolders of the foldername passed on the command line:
use Mail::Box::Manager;
my $mgr = Mail::Box::Manager->new;
my $flder = shift;
my $src = $mgr->open( folder => $flder, subfolder_extension => '.sbd', fix_headers => 1 );
for ($src->listSubFolders) {
my $x = $src->openSubFolder( $_ );
warn "$_ => ",
$src->nameOfSubFolder($_), ' => ',
scalar $x->messages, "\n";
}
$mgr->closeAllFolders;
but instead, I get something like this:
WARNING: Folder does not exist, failed opening mbox folder Perl/search.cpan.org.
Can't call method "messages" on an undefined value at ml2.pl line 7.
so listSubFolders successfully gets the folders in the Perl.sbd folder, but openSubFolder (and openRelatedFolder) do not honour the subfolder_extension option, renaming Perl.sbd to Perl.d results in expected behaviour:
search.cpan.org => Perl/search.cpan.org => 52089
rt.cpan.org => Perl/rt.cpan.org => 2928
also adding:
local $Mail::Box::Mbox::default_sub_extension = '.sbd';
in appropriate places works too.
It seems that sub Mail::Box::Mbox::folderToFilename doesn't get passed %args in $thingy, so this line:
$extension ||=
ref $thingy ? $thingy->{MBM_sub_ext} : $default_sub_extension;
only ever uses $default_sub_extension instead of $args{MBM_sub_ext}