Being a Perl beginner and not a programmer beginner certainly helps. You'll find many similarities with C and C++ (e.g. syntax elements like braces and semicolons used in a similar fashion), many apparent similarities (e.g. method calls), and something which is completely different (e.g. variables, dynamic scoping) :-)

I think a mail processor is kind of difficult to begin with because it involves many perlisms at the same time:

and so on...

There's certainly a more C-ish or C++ish way to write such a processor (we like to say there's more than one way to do it) but being already a programmer you're almost certainly interested in a more perlish approach. I think this can be achieved better by reading docs, books and lots of good code. This way, you'll find that using Net::IMAP is not different than using any other module: first yuo have to use it in your source, then after reading the relevant documentation you'll see that the author has provided a new constructor to create an IMAP connection and so on. Just as an example, most modules' documentation start with a minimal example that show how to use the module.

Net::IMAP is different because it uses a callback approach and therefore a bare bones example is not so trivial to prepare. That's another reason why I say it's a hard choice to start with :-) Then again, if you know C++ you certainly know what callbacks are, so the difficulty is not in the theory behind it but in the actual Perl implementation of a callback.

For example, have a look at Net::IMAP::Simple and you'll see an example you can try immediately. You can then use this example and extend it: scanning email messages, matching them against patterns, making your program configurable through switches or configuration files, sharing your effort with us :-)

-- TMTOWTDI


In reply to Re: Re: Re: A perl 'bot' for an imap server... by trantor
in thread A perl 'bot' for an imap server... by pim'

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.