{
    "content": [
        {
            "type": "text",
            "text": "# perlxstypemap (man)\n\n## NAME\n\nperlxstypemap - Perl XS C/Perl type mapping\n\n## DESCRIPTION\n\nThe more you think about interfacing between two languages, the more you'll realize that the\nmajority of programmer effort has to go into converting between the data structures that are\nnative to either of the languages involved.  This trumps other matter such as differing\ncalling conventions because the problem space is so much greater.  There are simply more ways\nto shove data into memory than there are ways to implement a function call.\n\n## Sections\n\n- **NAME**\n- **DESCRIPTION** (5 subsections)\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "perlxstypemap",
        "section": "",
        "mode": "man",
        "summary": "perlxstypemap - Perl XS C/Perl type mapping",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 17,
                "subsections": [
                    {
                        "name": "Anatomy of a typemap",
                        "lines": 99
                    },
                    {
                        "name": "The Role of the typemap File in Your Distribution",
                        "lines": 18
                    },
                    {
                        "name": "Sharing typemaps Between CPAN Distributions",
                        "lines": 15
                    },
                    {
                        "name": "Writing typemap Entries",
                        "lines": 33
                    },
                    {
                        "name": "Full Listing of Core Typemaps",
                        "lines": 351
                    }
                ]
            }
        ],
        "sections": {
            "NAME": {
                "content": "perlxstypemap - Perl XS C/Perl type mapping\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The more you think about interfacing between two languages, the more you'll realize that the\nmajority of programmer effort has to go into converting between the data structures that are\nnative to either of the languages involved.  This trumps other matter such as differing\ncalling conventions because the problem space is so much greater.  There are simply more ways\nto shove data into memory than there are ways to implement a function call.\n\nPerl XS' attempt at a solution to this is the concept of typemaps.  At an abstract level, a\nPerl XS typemap is nothing but a recipe for converting from a certain Perl data structure to\na certain C data structure and vice versa.  Since there can be C types that are sufficiently\nsimilar to one another to warrant converting with the same logic, XS typemaps are represented\nby a unique identifier, henceforth called an XS type in this document.  You can then tell the\nXS compiler that multiple C types are to be mapped with the same XS typemap.\n\nIn your XS code, when you define an argument with a C type or when you are using a \"CODE:\"\nand an \"OUTPUT:\" section together with a C return type of your XSUB, it'll be the typemapping\nmechanism that makes this easy.\n",
                "subsections": [
                    {
                        "name": "Anatomy of a typemap",
                        "content": "In more practical terms, the typemap is a collection of code fragments which are used by the\nxsubpp compiler to map C function parameters and values to Perl values.  The typemap file may\nconsist of three sections labelled \"TYPEMAP\", \"INPUT\", and \"OUTPUT\".  An unlabelled initial\nsection is assumed to be a \"TYPEMAP\" section.  The INPUT section tells the compiler how to\ntranslate Perl values into variables of certain C types.  The OUTPUT section tells the\ncompiler how to translate the values from certain C types into values Perl can understand.\nThe TYPEMAP section tells the compiler which of the INPUT and OUTPUT code fragments should be\nused to map a given C type to a Perl value.  The section labels \"TYPEMAP\", \"INPUT\", or\n\"OUTPUT\" must begin in the first column on a line by themselves, and must be in uppercase.\n\nEach type of section can appear an arbitrary number of times and does not have to appear at\nall.  For example, a typemap may commonly lack \"INPUT\" and \"OUTPUT\" sections if all it needs\nto do is associate additional C types with core XS types like TPTROBJ.  Lines that start\nwith a hash \"#\" are considered comments and ignored in the \"TYPEMAP\" section, but are\nconsidered significant in \"INPUT\" and \"OUTPUT\". Blank lines are generally ignored.\n\nTraditionally, typemaps needed to be written to a separate file, conventionally called\n\"typemap\" in a CPAN distribution.  With ExtUtils::ParseXS (the XS compiler) version 3.12 or\nbetter which comes with perl 5.16, typemaps can also be embedded directly into XS code using\na HERE-doc like syntax:\n\nTYPEMAP: <<HERE\n...\nHERE\n\nwhere \"HERE\" can be replaced by other identifiers like with normal Perl HERE-docs.  All\ndetails below about the typemap textual format remain valid.\n\nThe \"TYPEMAP\" section should contain one pair of C type and XS type per line as follows.  An\nexample from the core typemap file:\n\nTYPEMAP\n# all variants of char* is handled by the TPV typemap\nchar *          TPV\nconst char *    TPV\nunsigned char * TPV\n...\n\nThe \"INPUT\" and \"OUTPUT\" sections have identical formats, that is, each unindented line\nstarts a new in- or output map respectively.  A new in- or output map must start with the\nname of the XS type to map on a line by itself, followed by the code that implements it\nindented on the following lines. Example:\n\nINPUT\nTPV\n$var = ($type)SvPVnolen($arg)\nTPTR\n$var = INT2PTR($type,SvIV($arg))\n\nWe'll get to the meaning of those Perlish-looking variables in a little bit.\n\nFinally, here's an example of the full typemap file for mapping C strings of the \"char *\"\ntype to Perl scalars/strings:\n\nTYPEMAP\nchar *  TPV\n\nINPUT\nTPV\n$var = ($type)SvPVnolen($arg)\n\nOUTPUT\nTPV\nsvsetpv((SV*)$arg, $var);\n\nHere's a more complicated example: suppose that you wanted \"struct netconfig\" to be blessed\ninto the class \"Net::Config\".  One way to do this is to use underscores () to separate\npackage names, as follows:\n\ntypedef struct netconfig * NetConfig;\n\nAnd then provide a typemap entry \"TPTROBJSPECIAL\" that maps underscores to double-colons\n(::), and declare \"NetConfig\" to be of that type:\n\nTYPEMAP\nNetConfig      TPTROBJSPECIAL\n\nINPUT\nTPTROBJSPECIAL\nif (svderivedfrom($arg, \\\"${(my $ntt=$ntype)=~s//::/g;\\$ntt}\\\")){\nIV tmp = SvIV((SV*)SvRV($arg));\n$var = INT2PTR($type, tmp);\n}\nelse\ncroak(\\\"$var is not of type ${(my $ntt=$ntype)=~s//::/g;\\$ntt}\\\")\n\nOUTPUT\nTPTROBJSPECIAL\nsvsetrefpv($arg, \\\"${(my $ntt=$ntype)=~s//::/g;\\$ntt}\\\",\n(void*)$var);\n\nThe INPUT and OUTPUT sections substitute underscores for double-colons on the fly, giving the\ndesired effect.  This example demonstrates some of the power and versatility of the typemap\nfacility.\n\nThe \"INT2PTR\" macro (defined in perl.h) casts an integer to a pointer of a given type, taking\ncare of the possible different size of integers and pointers.  There are also \"PTR2IV\",\n\"PTR2UV\", \"PTR2NV\" macros, to map the other way, which may be useful in OUTPUT sections.\n"
                    },
                    {
                        "name": "The Role of the typemap File in Your Distribution",
                        "content": "The default typemap in the lib/ExtUtils directory of the Perl source contains many useful\ntypes which can be used by Perl extensions.  Some extensions define additional typemaps which\nthey keep in their own directory.  These additional typemaps may reference INPUT and OUTPUT\nmaps in the main typemap.  The xsubpp compiler will allow the extension's own typemap to\noverride any mappings which are in the default typemap.  Instead of using an additional\ntypemap file, typemaps may be embedded verbatim in XS with a heredoc-like syntax.  See the\ndocumentation on the \"TYPEMAP:\" XS keyword.\n\nFor CPAN distributions, you can assume that the XS types defined by the perl core are already\navailable. Additionally, the core typemap has default XS types for a large number of C types.\nFor example, if you simply return a \"char *\" from your XSUB, the core typemap will have this\nC type associated with the TPV XS type.  That means your C string will be copied into the PV\n(pointer value) slot of a new scalar that will be returned from your XSUB to Perl.\n\nIf you're developing a CPAN distribution using XS, you may add your own file called typemap\nto the distribution.  That file may contain typemaps that either map types that are specific\nto your code or that override the core typemap file's mappings for common C types.\n"
                    },
                    {
                        "name": "Sharing typemaps Between CPAN Distributions",
                        "content": "Starting with ExtUtils::ParseXS version 3.1301 (comes with perl 5.16 and better), it is\nrather easy to share typemap code between multiple CPAN distributions. The general idea is to\nshare it as a module that offers a certain API and have the dependent modules declare that as\na built-time requirement and import the typemap into the XS. An example of such a typemap-\nsharing module on CPAN is \"ExtUtils::Typemaps::Basic\". Two steps to getting that module's\ntypemaps available in your code:\n\n•   Declare \"ExtUtils::Typemaps::Basic\" as a build-time dependency in \"Makefile.PL\" (use\n\"BUILDREQUIRES\"), or in your \"Build.PL\" (use \"buildrequires\").\n\n•   Include the following line in the XS section of your XS file: (don't break the line)\n\nINCLUDECOMMAND: $^X -MExtUtils::Typemaps::Cmd\n-e \"print embeddabletypemap(q{Basic})\"\n"
                    },
                    {
                        "name": "Writing typemap Entries",
                        "content": "Each INPUT or OUTPUT typemap entry is a double-quoted Perl string that will be evaluated in\nthe presence of certain variables to get the final C code for mapping a certain C type.\n\nThis means that you can embed Perl code in your typemap (C) code using constructs such as \"${\nperl code that evaluates to scalar reference here }\". A common use case is to generate error\nmessages that refer to the true function name even when using the ALIAS XS feature:\n\n${ $ALIAS ? \\q[GvNAME(CvGV(cv))] : \\qq[\\\"$pname\\\"] }\n\nFor many typemap examples, refer to the core typemap file that can be found in the perl\nsource tree at lib/ExtUtils/typemap.\n\nThe Perl variables that are available for interpolation into typemaps are the following:\n\n•   $var - the name of the input or output variable, eg. RETVAL for return values.\n\n•   $type - the raw C type of the parameter, any \":\" replaced with \"\".  e.g. for a type of\n\"Foo::Bar\", $type is \"FooBar\"\n\n•   $ntype - the supplied type with \"*\" replaced with \"Ptr\".  e.g. for a type of \"Foo*\",\n$ntype is \"FooPtr\"\n\n•   $arg - the stack entry, that the parameter is input from or output to, e.g. ST(0)\n\n•   $argoff - the argument stack offset of the argument.  ie. 0 for the first argument, etc.\n\n•   $pname - the full name of the XSUB, with including the \"PACKAGE\" name, with any \"PREFIX\"\nstripped.  This is the non-ALIAS name.\n\n•   $Package - the package specified by the most recent \"PACKAGE\" keyword.\n\n•   $ALIAS - non-zero if the current XSUB has any aliases declared with \"ALIAS\".\n"
                    },
                    {
                        "name": "Full Listing of Core Typemaps",
                        "content": "Each C type is represented by an entry in the typemap file that is responsible for converting\nperl variables (SV, AV, HV, CV, etc.)  to and from that type. The following sections list all\nXS types that come with perl by default.\n\nTSV\nThis simply passes the C representation of the Perl variable (an SV*) in and out of the\nXS layer. This can be used if the C code wants to deal directly with the Perl variable.\n\nTSVREF\nUsed to pass in and return a reference to an SV.\n\nNote that this typemap does not decrement the reference count when returning the\nreference to an SV*.  See also: TSVREFREFCOUNTFIXED\n\nTSVREFFIXED\nUsed to pass in and return a reference to an SV.  This is a fixed variant of TSVREF that\ndecrements the refcount appropriately when returning a reference to an SV*. Introduced in\nperl 5.15.4.\n\nTAVREF\nFrom the perl level this is a reference to a perl array.  From the C level this is a\npointer to an AV.\n\nNote that this typemap does not decrement the reference count when returning an AV*. See\nalso: TAVREFREFCOUNTFIXED\n\nTAVREFREFCOUNTFIXED\nFrom the perl level this is a reference to a perl array.  From the C level this is a\npointer to an AV. This is a fixed variant of TAVREF that decrements the refcount\nappropriately when returning an AV*. Introduced in perl 5.15.4.\n\nTHVREF\nFrom the perl level this is a reference to a perl hash.  From the C level this is a\npointer to an HV.\n\nNote that this typemap does not decrement the reference count when returning an HV*. See\nalso: THVREFREFCOUNTFIXED\n\nTHVREFREFCOUNTFIXED\nFrom the perl level this is a reference to a perl hash.  From the C level this is a\npointer to an HV. This is a fixed variant of THVREF that decrements the refcount\nappropriately when returning an HV*. Introduced in perl 5.15.4.\n\nTCVREF\nFrom the perl level this is a reference to a perl subroutine (e.g. $sub = sub { 1 };).\nFrom the C level this is a pointer to a CV.\n\nNote that this typemap does not decrement the reference count when returning an HV*. See\nalso: THVREFREFCOUNTFIXED\n\nTCVREFREFCOUNTFIXED\nFrom the perl level this is a reference to a perl subroutine (e.g. $sub = sub { 1 };).\nFrom the C level this is a pointer to a CV.\n\nThis is a fixed variant of THVREF that decrements the refcount appropriately when\nreturning an HV*. Introduced in perl 5.15.4.\n\nTSYSRET\nThe TSYSRET typemap is used to process return values from system calls.  It is only\nmeaningful when passing values from C to perl (there is no concept of passing a system\nreturn value from Perl to C).\n\nSystem calls return -1 on error (setting ERRNO with the reason) and (usually) 0 on\nsuccess. If the return value is -1 this typemap returns \"undef\". If the return value is\nnot -1, this typemap translates a 0 (perl false) to \"0 but true\" (which is perl true) or\nreturns the value itself, to indicate that the command succeeded.\n\nThe POSIX module makes extensive use of this type.\n\nTUV\nAn unsigned integer.\n\nTIV\nA signed integer. This is cast to the required integer type when passed to C and\nconverted to an IV when passed back to Perl.\n\nTINT\nA signed integer. This typemap converts the Perl value to a native integer type (the\n\"int\" type on the current platform). When returning the value to perl it is processed in\nthe same way as for TIV.\n\nIts behaviour is identical to using an \"int\" type in XS with TIV.\n\nTENUM\nAn enum value. Used to transfer an enum component from C. There is no reason to pass an\nenum value to C since it is stored as an IV inside perl.\n\nTBOOL\nA boolean type. This can be used to pass true and false values to and from C.\n\nTUINT\nThis is for unsigned integers. It is equivalent to using TUV but explicitly casts the\nvariable to type \"unsigned int\".  The default type for \"unsigned int\" is TUV.\n\nTSHORT\nShort integers. This is equivalent to TIV but explicitly casts the return to type\n\"short\". The default typemap for \"short\" is TIV.\n\nTUSHORT\nUnsigned short integers. This is equivalent to TUV but explicitly casts the return to\ntype \"unsigned short\". The default typemap for \"unsigned short\" is TUV.\n\nTUSHORT is used for type \"U16\" in the standard typemap.\n\nTLONG\nLong integers. This is equivalent to TIV but explicitly casts the return to type \"long\".\nThe default typemap for \"long\" is TIV.\n\nTULONG\nUnsigned long integers. This is equivalent to TUV but explicitly casts the return to\ntype \"unsigned long\". The default typemap for \"unsigned long\" is TUV.\n\nTULONG is used for type \"U32\" in the standard typemap.\n\nTCHAR\nSingle 8-bit characters.\n\nTUCHAR\nAn unsigned byte.\n\nTFLOAT\nA floating point number. This typemap guarantees to return a variable cast to a \"float\".\n\nTNV\nA Perl floating point number. Similar to TIV and TUV in that the return type is cast to\nthe requested numeric type rather than to a specific type.\n\nTDOUBLE\nA double precision floating point number. This typemap guarantees to return a variable\ncast to a \"double\".\n\nTPV\nA string (char *).\n\nTPTR\nA memory address (pointer). Typically associated with a \"void *\" type.\n\nTPTRREF\nSimilar to TPTR except that the pointer is stored in a scalar and the reference to that\nscalar is returned to the caller. This can be used to hide the actual pointer value from\nthe programmer since it is usually not required directly from within perl.\n\nThe typemap checks that a scalar reference is passed from perl to XS.\n\nTPTROBJ\nSimilar to TPTRREF except that the reference is blessed into a class.  This allows the\npointer to be used as an object. Most commonly used to deal with C structs. The typemap\nchecks that the perl object passed into the XS routine is of the correct class (or part\nof a subclass).\n\nThe pointer is blessed into a class that is derived from the name of type of the pointer\nbut with all '*' in the name replaced with 'Ptr'.\n\nFor \"DESTROY\" XSUBs only, a TPTROBJ is optimized to a TPTRREF. This means the class\ncheck is skipped.\n\nTREFIVREF\nNOT YET\n\nTREFIVPTR\nSimilar to TPTROBJ in that the pointer is blessed into a scalar object.  The difference\nis that when the object is passed back into XS it must be of the correct type\n(inheritance is not supported) while TPTROBJ supports inheritance.\n\nThe pointer is blessed into a class that is derived from the name of type of the pointer\nbut with all '*' in the name replaced with 'Ptr'.\n\nFor \"DESTROY\" XSUBs only, a TREFIVPTR is optimized to a TPTRREF. This means the class\ncheck is skipped.\n\nTPTRDESC\nNOT YET\n\nTREFREF\nSimilar to TPTRREF, except the pointer stored in the referenced scalar is dereferenced\nand copied to the output variable. This means that TREFREF is to TPTRREF as TOPAQUE is\nto TOPAQUEPTR. All clear?\n\nOnly the INPUT part of this is implemented (Perl to XSUB) and there are no known users in\ncore or on CPAN.\n\nTREFOBJ\nLike TREFREF, except it does strict type checking (inheritance is not supported).\n\nFor \"DESTROY\" XSUBs only, a TREFOBJ is optimized to a TREFREF. This means the class\ncheck is skipped.\n\nTOPAQUEPTR\nThis can be used to store bytes in the string component of the SV. Here the\nrepresentation of the data is irrelevant to perl and the bytes themselves are just stored\nin the SV. It is assumed that the C variable is a pointer (the bytes are copied from that\nmemory location).  If the pointer is pointing to something that is represented by 8 bytes\nthen those 8 bytes are stored in the SV (and length() will report a value of 8). This\nentry is similar to TOPAQUE.\n\nIn principle the unpack() command can be used to convert the bytes back to a number (if\nthe underlying type is known to be a number).\n\nThis entry can be used to store a C structure (the number of bytes to be copied is\ncalculated using the C \"sizeof\" function) and can be used as an alternative to TPTRREF\nwithout having to worry about a memory leak (since Perl will clean up the SV).\n\nTOPAQUE\nThis can be used to store data from non-pointer types in the string part of an SV. It is\nsimilar to TOPAQUEPTR except that the typemap retrieves the pointer directly rather than\nassuming it is being supplied. For example, if an integer is imported into Perl using\nTOPAQUE rather than TIV the underlying bytes representing the integer will be stored in\nthe SV but the actual integer value will not be available. i.e. The data is opaque to\nperl.\n\nThe data may be retrieved using the \"unpack\" function if the underlying type of the byte\nstream is known.\n\nTOPAQUE supports input and output of simple types.  TOPAQUEPTR can be used to pass\nthese bytes back into C if a pointer is acceptable.\n\nImplicit array\nxsubpp supports a special syntax for returning packed C arrays to perl. If the XS return\ntype is given as\n\narray(type, nelem)\n\nxsubpp will copy the contents of \"nelem * sizeof(type)\" bytes from RETVAL to an SV and\npush it onto the stack. This is only really useful if the number of items to be returned\nis known at compile time and you don't mind having a string of bytes in your SV.  Use\nTARRAY to push a variable number of arguments onto the return stack (they won't be\npacked as a single string though).\n\nThis is similar to using TOPAQUEPTR but can be used to process more than one element.\n\nTPACKED\nCalls user-supplied functions for conversion. For \"OUTPUT\" (XSUB to Perl), a function\nnamed \"XSpack$ntype\" is called with the output Perl scalar and the C variable to\nconvert from.  $ntype is the normalized C type that is to be mapped to Perl. Normalized\nmeans that all \"*\" are replaced by the string \"Ptr\". The return value of the function is\nignored.\n\nConversely for \"INPUT\" (Perl to XSUB) mapping, the function named \"XSunpack$ntype\" is\ncalled with the input Perl scalar as argument and the return value is cast to the mapped\nC type and assigned to the output C variable.\n\nAn example conversion function for a typemapped struct \"foot *\" might be:\n\nstatic void\nXSpackfootPtr(SV *out, foot *in)\n{\ndTHX; /* alas, signature does not include pTHX */\nHV* hash = newHV();\nhvstores(hash, \"intmember\", newSViv(in->intmember));\nhvstores(hash, \"floatmember\", newSVnv(in->floatmember));\n/* ... */\n\n/* mortalize as thy stack is not refcounted */\nsvsetsv(out, sv2mortal(newRVnoinc((SV*)hash)));\n}\n\nThe conversion from Perl to C is left as an exercise to the reader, but the prototype\nwould be:\n\nstatic foot *\nXSunpackfootPtr(SV *in);\n\nInstead of an actual C function that has to fetch the thread context using \"dTHX\", you\ncan define macros of the same name and avoid the overhead. Also, keep in mind to possibly\nfree the memory allocated by \"XSunpackfootPtr\".\n\nTPACKEDARRAY\nTPACKEDARRAY is similar to TPACKED. In fact, the \"INPUT\" (Perl to XSUB) typemap is\nidentical, but the \"OUTPUT\" typemap passes an additional argument to the \"XSpack$ntype\"\nfunction. This third parameter indicates the number of elements in the output so that the\nfunction can handle C arrays sanely. The variable needs to be declared by the user and\nmust have the name \"count$ntype\" where $ntype is the normalized C type name as explained\nabove. The signature of the function would be for the example above and \"foot \":\n\nstatic void\nXSpackfootPtrPtr(SV *out, foot *in, UV countfootPtrPtr);\n\nThe type of the third parameter is arbitrary as far as the typemap is concerned. It just\nhas to be in line with the declared variable.\n\nOf course, unless you know the number of elements in the \"sometype \" C array, within\nyour XSUB, the return value from \"foot  XSunpackfootPtrPtr(...)\" will be hard to\ndecipher.  Since the details are all up to the XS author (the typemap user), there are\nseveral solutions, none of which particularly elegant.  The most commonly seen solution\nhas been to allocate memory for N+1 pointers and assign \"NULL\" to the (N+1)th to\nfacilitate iteration.\n\nAlternatively, using a customized typemap for your purposes in the first place is\nprobably preferable.\n\nTDATAUNIT\nNOT YET\n\nTCALLBACK\nNOT YET\n\nTARRAY\nThis is used to convert the perl argument list to a C array and for pushing the contents\nof a C array onto the perl argument stack.\n\nThe usual calling signature is\n\n@out = arrayfunc( @in );\n\nAny number of arguments can occur in the list before the array but the input and output\narrays must be the last elements in the list.\n\nWhen used to pass a perl list to C the XS writer must provide a function (named after the\narray type but with 'Ptr' substituted for '*') to allocate the memory required to hold\nthe list. A pointer should be returned. It is up to the XS writer to free the memory on\nexit from the function. The variable \"ix$var\" is set to the number of elements in the\nnew array.\n\nWhen returning a C array to Perl the XS writer must provide an integer variable called\n\"size$var\" containing the number of elements in the array. This is used to determine how\nmany elements should be pushed onto the return argument stack. This is not required on\ninput since Perl knows how many arguments are on the stack when the routine is called.\nOrdinarily this variable would be called \"sizeRETVAL\".\n\nAdditionally, the type of each element is determined from the type of the array. If the\narray uses type \"intArray *\" xsubpp will automatically work out that it contains\nvariables of type \"int\" and use that typemap entry to perform the copy of each element.\nAll pointer '*' and 'Array' tags are removed from the name to determine the subtype.\n\nTSTDIO\nThis is used for passing perl filehandles to and from C using \"FILE *\" structures.\n\nTINOUT\nThis is used for passing perl filehandles to and from C using \"PerlIO *\" structures. The\nfile handle can used for reading and writing. This corresponds to the \"+<\" mode, see also\nTIN and TOUT.\n\nSee perliol for more information on the Perl IO abstraction layer. Perl must have been\nbuilt with \"-Duseperlio\".\n\nThere is no check to assert that the filehandle passed from Perl to C was created with\nthe right \"open()\" mode.\n\nHint: The perlxstut tutorial covers the TINOUT, TIN, and TOUT XS types nicely.\n\nTIN\nSame as TINOUT, but the filehandle that is returned from C to Perl can only be used for\nreading (mode \"<\").\n\nTOUT\nSame as TINOUT, but the filehandle that is returned from C to Perl is set to use the\nopen mode \"+>\".\n\n\n\nperl v5.34.0                                 2025-07-25                             PERLXSTYPEMAP(1)"
                    }
                ]
            }
        }
    }
}