ExtUtils::Typemaps::Magic - Typemap for storing objects in magic
version 0.004
use ExtUtils::Typemaps::Magic; # First, read my own type maps: my $private_map = ExtUtils::Typemaps->new(file => 'my.map'); # Then, get the Magic set and merge it into my maps my $map = ExtUtils::Typemaps::Magic->new; $private_map->merge(typemap => $map); # Now, write the combined map to an output file $private_map->write(file => 'typemap');
ExtUtils::Typemaps::Magic is an ExtUtils::Typemaps subclass that is essentially a drop-in replacement for T_PTROBJ, except that it hides the value of the pointer from pure-perl code by storing it in attached magic. In particular that means the pointer won't be serialized/deserialized (this is usually a thing because after deserialization the pointer is probably not valid). Note that like T_PTROBJ, you probably need a DESTROY method to destroy and free the buffer, and this is not thread cloning safe without further measures.
ExtUtils::Typemaps::Magic
ExtUtils::Typemaps
T_PTROBJ
DESTROY
On perls older than 5.14, this will require ppport.h to provide mg_findext.
5.14
mg_findext
Leon Timmermans <leont@cpan.org>
This software is copyright (c) 2023 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install ExtUtils::Typemaps::Magic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ExtUtils::Typemaps::Magic
CPAN shell
perl -MCPAN -e shell install ExtUtils::Typemaps::Magic
For more information on module installation, please visit the detailed CPAN module installation guide.