Add tests about file rotation and deletion triggered by write() method. "rotate by period, daily + histories" test is failing.
Rename _rotate() to _rotate_and_delete() because it basically do both "rotate" and "delete".
Introduce "delete_only" option to _rotate_and_delete() to get rid of the ugly _tmp_hack_give_suffix_to_fp temporary attribute.
In addition, spec in rotate.t is modified: now _rotate_and_delete(delete_only => false) rotates files WHETHER OR NOT THE FILES HAVE PERIOD OR NOT.
I think this is much saner bahavior because files with period can also be rotated if we use "size" option.
If we want to disable rotating, use delete_only option explicitly.
The test fails because of a bug in Rotate.pm. I'm working on it.
t/rotate.t: add some test cases where files have complex periods and suffixes. failing.
Fix _get_files(): obviously period should have precedence over rotate suffix in order.
_rotate_and_delete() now rotates only files with the latest period.
rotate.t now passes.
t/write.t: add a subtest "rotate by size + period + histories" (perhaps the most complicated case?)
write.t: introduce test_filehandle_cache() test routine. _fp and _fh in FWR object are basically just cache, so most tests should pass whether or not they are set.
compress() method seems to emit warnings when called without filehandle cache. Maybe we can get rid of _cur_period?
rotate with delete_only => 1 when a new file is created. Finally pass write.t
A LITTLE INCOMPATIBLE: compress() method now avoids compressing files with the latest period.
Before, this method avoided compressing files with the period of "_cur_period" private attribute, which was set by _open().
However, "_cur_period" was not set if compress() was called without calling write() beforehand.
The new behavior is a little different from the old, but it's the same in most cases.
write.t: The files should be always unlocked after write(). Failing when hooks die.
document: mention hook_* parameters in new() method.
write.t: add tests about hook_before_write.
Remove _lock() and _unlock() methods, and add _get_lock() method instead. Pass write.t.

The old code had two problems:
1. It cached the SHARYANTO::File::Flock object, so the lock file remained if some hook died.
2. It called SHARYANTO::File::Flock's private methods.

SHARYANTO::File::Flock object removes the lock file when it's get DESTROYed.
The new code takes advantage of this feature to ensure the lock is always removed
when write() is done.
Merge pull request #9 from debug-ito/fix_period_deletion_and_lock