in reply to Re: Re: A perl 'bot' for an imap server...
in thread A perl 'bot' for an imap server...

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

Replies are listed 'Best First'.
Re: Re: Re: Re: A perl 'bot' for an imap server...
by pim' (Initiate) on Aug 03, 2001 at 15:23 UTC
    Many thanx trantor.
    I agree with the existing common-points of thoses 2 languages.
    In fact, if i'm starting to code in Perl, but i've already done some small "apps" using sockets...
    but my main pb, was that the doc wich i had one hand on, was pretty poor
    And i didn't want to spend my days 'parsing' RFCs... :)
    Anyway, if i'm interested into Perl, it's for:
    - the huge string processing capabilities
    - the efficienty of the code compared to its size
    - and last: because my mentor (an all-type-administrator)
    told me that if i wanted to become a real admin', i HAD to learn perl, moreover for *nix boxes...
    he told me "otherwise, u're just a ...wannabe" ... :p
    It's the last thing that made,the most,me feel obliged to learn it :)

    Many thanx for your post, i'll take the time to learn it slowly, to assimilite it in the best possible way.
    And first i'll start with NET::IMAP:Simple... :)