Team,
I came across Nimrod 4-5 days ago. The language looks quite appealing!
As an exercise, I wrote a small script for checking the 'alive' status of a specified set of HTTP sites. You can find it at https://github.com/js-ojus/heartbeat.nimrod. Please provide some feedback on how to make it more Nimrod-like. That I could learn the language enough (in three days) to write the said program in about 4 hours is, in my opinion, a testimony to both the language design choices and the standard library breadth. Congratulations to Araq and the other authors!
Based on my experiences in writing the above, I have some questions.
if ln =~ re", ANSWER: (\d+),":
let n = parseInt(matches[0])
if n > 0:
...
This, however, did not work -- there was never a match. I then tried almost all the procs in the module re to no avail. I would appreciate some suggestions.
Thanks!
-- 0|0
The flags of the re constructor default to {reExtended, reStudy}. reExtended means whitespace is ignored in your pattern so you can keep them readable. Use this instead:
if ln =~ re(", ANSWER: (\d+),", {}):
or rewrite your pattern so that it uses \s instead.
Hello!
(2) In the module ``smtp``, is there a way I could set a custom 'From:' address that includes a name?
Yes, you can specify extra headers when creating your message:
var msg = createMessage(subject, body, mTo, @[], [("From", "from@address")])
This may work, I haven't tested it btw.
(3) In the module ``httpclient``, is there a way to have separate timeout specifications for 'connect' and 'read'?
Sorry, no way to do that.
I noticed that you use .format in your code. You can use the % operator to make it a little bit nicer if you wish:
writeln(log, "$1 : [ERROR] $2 : $3." % [tAt, server, "could not be resolved/reached"])
Araq: The flags of the re constructor default to {reExtended, reStudy}. reExtended means whitespace is ignored in your pattern so you can keep them readable.
Thanks, I used the module pegs successfully (it has increased the size of the binary significantly, though).
dom96: Yes, you can specify extra headers when creating your message ...
Thanks, it has worked!
dom96: I noticed that you use .format in your code. You can use the % operator to make it a little bit nicer if you wish.
Sure, I have adopted it!
-- 0|0