NAME

Mail::Box::MH::Resource - Manage an MH resource file such as the MH profile

SYNOPSIS

#Create object and load profile
my $prof = Mail::Box::MH::Resource->new();

#Get a list of the profile components
my @keys = $prof->enum();

#Get MH directory to pass to Mail::Box::Manager
my $folderdir = $prof->get('Path');
$folderdir = File::Spec->file_name_is_absolute($folderdir->{Path}) ?
                                               $folderdir->{Path}  :
               File::Spec->catfile($ENV{HOME}, $folderdir->{Path})

#Permanently remove messages
$prof->set('rmmproc'=>'rm');

#Save changes
$prof->close();

DESCRIPTION

Read and write MH format resource files such as profile, context, and sequence.

METHODS

new [FILENAME]

Open a resource file, accepts an optional filename of the resource file to open. Non-absolute filenames which do not start with your system's designation for the current directory are opened relative to the MH profile Path component. ./ should work on most right minded systems, : for Macintosh, see File::Spec if you don't what it is for your system. If unspecified new falls back to $ENV{MH} and then $HOME/.mh_profile.

Example:

#Create a new profile
my $prof = Mail::Box::MH::Resource->new('/tmp/.mh_profile');

#Load the context file to determine the currently selected folder
my $cntx = Mail::Box::MH::Resource->new('current');
enum

Returns a list of existing component names.

get COMPONENT [COMPONENTS]

Return the values of one or more components. See "SYNOPSIS" for an example.

set COMPONENT [COMPONENTS]

Set the values of one or more components. See "SYNOPSIS" for an example.

close

Write the resource file to disk, original component ordering is not preserved.

CAVEATS

Order is not preserved therefore "comments" may end up misplaced.

SEE ALSO

mh-profile(5), Mail::Box::MH.

AUTHOR

Jerrad Pierce <jpierce@cpan.org>