I am trying to acces my mail box using the Mail::Box module but get the following error message:

ERROR: Cannot get a lock on Mail::Box::Mbox folder /var/mail/username.
WARNING: Folder does not exist, failed opening mbox folder /var/mail/username.

I am just starting this script and only have the following lines of code so far:
use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => $ENV{MAIL});
How can I get a lock on the file?

Is there a way to get Mail::MboxParser to delete mail?   I can read the mail with that but I would like to delete the mail once I am done with it.

Thanks in advance.

janitored by ybiC: Minor format cleanup, including balanced <code> tags around snippet and linkify mentions of CPAN modules


In reply to Need help with Mail::Box module please by Bytor_47

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.