Hello,
The PLEAC project aims to translate the source code examples of the Perl
Cookbook to many programming languages. I have been working steadily for
the past two years toward completing the OCaml translation. As of today,
it is 70.71% complete, in between Ruby (64.43%) and Python (85.43%).
http://pleac.sourceforge.net/
http://pleac.sourceforge.net/pleac_ocaml/index.html
Much of my recent work has been on the file I/O chapters, which cover
the topics of reading and writing to files using Pervasives and the Unix
module. The file access chapter covers argument parsing, file locking,
buffering and non-blocking I/O:
http://pleac.sourceforge.net/pleac_ocaml/fileaccess.html
The file contents chapter contains some helpful examples of working with
Streams and Buffers, line-indexing of large files, and manipulation of
binary data including an example of using Richard Jones' Bitmatch
library to parse and "tail" Linux's binary "utmp" database of login events:
http://pleac.sourceforge.net/pleac_ocaml/filecontents.html
I have updated the PDF version as well, if you prefer to read PLEAC in
an offline format. You can download it here:
http://ramenlabs.com/pleac-pdf/pleac_ocaml.pdf
As always, feedback, corrections, and contributions are more than
welcome, and I will do my best to make suggested improvements. I think
that, despite being somewhat Perl-centric and in need of more
explanation, the OCaml PLEAC has already become a valuable resource. I
refer to it frequently myself. Hopefully some day there will be a real
OCaml Cookbook. In the meantime, there are a lot of practical code
snippets that can save a few trips to the manual / interface files. I
hope you find it useful as well.
Thanks,
Dave