On 21 July 2015 at 03:35, Rick Leir <[email protected]> wrote: > My question is how can you delete all the images but retain the > Graphics::Magick object? I do not want to use the undef loop above. With > normal perlmagick, you would say > @$image = (); > ( http://www.graphicsmagick.org/perl.html ) > > Should I learn more about Perl XS? TIA
Q) What value is there in persisting the GM object across uses? Why do you need to do this? Without good reason, I would take the advice in the Linked article, and just `undef` the GM object. The natural way of doing this in Moo would be to use a clearer https://metacpan.org/pod/Moo#has #{ Takes a method name which will clear the attribute. If you set this to just 1, the clearer is automatically named clear_${attr_name} if your attribute's name does not start with an underscore, or _clear_${attr_name_without_the_underscore} if it does. This feature comes from MooseX::AttributeShortcuts. #} That way, when you're done, you just call $self->_clear_image; And if you need an image later, a new one will be constructed by the builder. -- Kent KENTNL - https://metacpan.org/author/KENTNL
