perl: Add explicit close() method (RHBZ#602592).
This add an optional explicit $g->close method which may be
used to force the handle to be closed immediately. Note the
provisos about this method in the manual page entry. Callers
should *not* normally use this method.
The implementation of the handle also changes. Before, the
handle was a blessed reference to an integer (the integer
being the pointer to the C guestfs_h handle). Now we change
this to a hashref containing currently the following field:
_g => pointer to C guestfs_h handle (as an integer)
If this field is not present, it means that the handle has been
explicitly closed. This avoids double-freeing the handle.
The user may add their own fields to this hash in order to store
per-handle data. However any fields whose names begin with
an underscore are reserved for use by the Perl bindings.
This commit also adds a regression test.
This commit also changes the existing warning when you call
a method without a Sys::Guestfs handle as the first parameter,
into an error. This is because such cases are always errors.