- (or "undef" when no private data constructor was supplied). In the
- special case of "len" magic and when the variable is an array, $_[2]
- contains its normal length. "copy" magic receives the current
- element (i.e. the value) in $_[2]. $_[2] is also the current key in
- "fetch", "store", "exists" and "delete" callbacks.
+ (or "undef" when no private data constructor was supplied). Other
+ arguments are specific to the magic hooked :
+
+ - "len"
+
+ When the variable is an array, $_[2] contains the normal
+ length. The callback is also expected to return the new
+ scalar or array length.
+
+ - "copy"
+
+ $_[2] is a either a copy or an alias of the current key,
+ which means that it is useless to try to change or cast
+ magic on it. $_[3] is an alias to the current element (i.e.
+ the value).
+
+ - "fetch", "store", "exists" and "delete"
+
+ $_[2] is an alias to the current key. Nothing prevents you
+ from changing it, but be aware that there lurk dangerous
+ side effects. For example, it may righteously be readonly if
+ the key was a bareword. You can get a copy instead by
+ passing "copy_key => 1" to "wizard", which allows you to
+ safely assign to $_[2] in order to e.g. redirect the action
+ to another key. This however has a little performance
+ drawback because of the copy.
+
+ All the callbacks are expected to return an integer, which is passed
+ straight to the perl magic API. However, only the return value of
+ the "len" callback currently holds a meaning.