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:
- using modules
- using regular expressions
- anonymous storage
- dealing with files
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
|