in reply to advice on OO and perlmagick
In simple terms a perl object is nothing but a pointer to a normal perl data structure with some internal flag that elevates it to an object. (before anyone objects, yes, there is a bit more, especially a connection to a class).
Most of the time the normal data structure is a hash which doubles as data storage for the object. PerlMagick uses an array as basis of its object. And judging from the documentation, it can either store image data into this array, or recursively other image objects (at least that is my theory, can't test it as Image::Magick wouldn't install when I tried it a minute ago). You can see that in this snippet from an example in the PerlMagick documentation:
$p = $image->[1]; $p->Draw(stroke=>'red', primitive=>'rectangle', points=>20,20 100,10 +0');
One of the entries of the object array is taken and on this sub-object the Draw operation is called. To really be sure one would have to print ref($p) to see if it isn't a different object from ref($image), but it seems a neat way to allow the storage and manipulation of more than one image. Now a bit more clarity in the documentation would have been helpful
|
|---|