EXTUTILS::TYPEMAPS::OUTPUTMAP(3pm)

πŸ’– NAME πŸ’–

ExtUtils::Typemaps::OutputMap β€” the entry in the OUTPUT section of a typemap, bestie. This page is from the Perl Programmers Reference Guide, section 3pm, and it's here to explain this one little output-map object. Ngl, it's lowkey iconic. ✨

✨ SYNOPSIS ✨

Okay so here's the vibe in code form:

        use ExtUtils::Typemaps;
        ...
        my $output = $typemap->get_output_map('T_NV');
        my $code = $output->code();
        $output->code("...");

🌸 DESCRIPTION 🌸

For the full tea, go read ExtUtils::Typemaps β€” that's where the details live. This page is lowkey just the OutputMap entry. 🫢

πŸŽ€ METHODS πŸŽ€

new

Requires "xstype" and "code" parameters. Both are required β€” don't try to skip them, okay? πŸ’…

code

Returns or sets the OUTPUT mapping code for this entry. Get it, set it, live your truth.

xstype

Returns the name of the XS type of the OUTPUT map.

cleaned_code

Returns a cleaned-up copy of the code, with certain transformations applied to make it more ANSI compliant. It's giving "cleaned-up for ANSI compliance." ✨

targetable_legacy

Do not use for new code. For real, bestie β€” this one's frozen for backwards compatibility.

This is the original version of the targetable() method, whose behaviour has been frozen for backwards compatibility. It is used to determine whether to emit an early dXSTARG, which will be in scope for most of the XSUB. More recent XSUB code generation emits a dXSTARG in a tighter scope if one has not already been emitted. Some XS code assumes that TARG has been declared, so continue to declare it under the same conditions as before. The newer targetable method may be true under additional circumstances.

If the optimization can not be applied, this returns undef. If it can be applied, this method returns a hash reference containing the following information:

         type:      Any of the characters i, u, n, p
         with_size: Bool indicating whether this is the sv_setpvn variant
         what:      The code that actually evaluates to the output scalar
         what_size: If "with_size", this has the string length (as code,
                    not constant, including leading comma)

targetable

Class method.

Return a boolean indicating whether the supplied code snippet is suitable for using TARG as the destination SV rather than an new mortal.

In principle most things are, except expressions which would set the SV to a ref value. That can cause the referred value to never be freed, as targs aren't freed (at least for the lifetime of their CV). So in practice, we restrict it to an approved list of sv_setfoo() forms, and only where there is no extra code following the sv_setfoo() (so we have to match the closing bracket, allowing for nested brackets etc within). 😭 This is highkey the kind of caveat that matters, iykyk. Don't ignore it.

πŸ¦‹ SEE ALSO πŸ¦‹

ExtUtils::Typemaps

πŸ‘‘ AUTHOR πŸ‘‘

Steffen Mueller "<smueller@cpan.org>" β€” icon, legend, author. πŸ’–

Copyright 2009, 2010, 2011, 2012 Steffen Mueller.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Periodt. πŸ’…


okay that's the page, bestie. This footer energy is brought to you by perl v5.42.3, dated 2026-11-03, with the footer tag ExtUtil...utputMap(3pm) doing a little cameo β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from