{
    "content": [
        {
            "type": "text",
            "text": "# perlapio (man)\n\n## NAME\n\nperlapio - perl's IO abstraction interface.\n\n## SYNOPSIS\n\n#define PERLIONOTSTDIO 0    /* For co-existence with stdio only */\n#include <perlio.h>           /* Usually via #include <perl.h> */\nPerlIO *PerlIOstdin(void);\nPerlIO *PerlIOstdout(void);\nPerlIO *PerlIOstderr(void);\nPerlIO *PerlIOopen(const char *path,const char *mode);\nPerlIO *PerlIOfdopen(int fd, const char *mode);\nPerlIO *PerlIOreopen(const char *path, /* deprecated */\nconst char *mode, PerlIO *old);\nint     PerlIOclose(PerlIO *f);\nint     PerlIOstdoutf(const char *fmt,...)\nint     PerlIOputs(PerlIO *f,const char *string);\nint     PerlIOputc(PerlIO *f,int ch);\nSSizet PerlIOwrite(PerlIO *f,const void *buf,sizet numbytes);\nint     PerlIOprintf(PerlIO *f, const char *fmt,...);\nint     PerlIOvprintf(PerlIO *f, const char *fmt, valist args);\nint     PerlIOflush(PerlIO *f);\nint     PerlIOeof(PerlIO *f);\nint     PerlIOerror(PerlIO *f);\nvoid    PerlIOclearerr(PerlIO *f);\nint     PerlIOgetc(PerlIO *d);\nint     PerlIOungetc(PerlIO *f,int ch);\nSSizet PerlIOread(PerlIO *f, void *buf, sizet numbytes);\nint     PerlIOfileno(PerlIO *f);\nvoid    PerlIOsetlinebuf(PerlIO *f);\nOfft   PerlIOtell(PerlIO *f);\nint     PerlIOseek(PerlIO *f, Offt offset, int whence);\nvoid    PerlIOrewind(PerlIO *f);\nint     PerlIOgetpos(PerlIO *f, SV *save);    /* prototype changed */\nint     PerlIOsetpos(PerlIO *f, SV *saved);   /* prototype changed */\nint     PerlIOfastgets(PerlIO *f);\nint     PerlIOhascntptr(PerlIO *f);\nSSizet PerlIOgetcnt(PerlIO *f);\nchar   *PerlIOgetptr(PerlIO *f);\nvoid    PerlIOsetptrcnt(PerlIO *f, char *ptr, SSizet count);\nint     PerlIOcansetcnt(PerlIO *f);              /* deprecated */\nvoid    PerlIOsetcnt(PerlIO *f, int count);      /* deprecated */\nint     PerlIOhasbase(PerlIO *f);\nchar   *PerlIOgetbase(PerlIO *f);\nSSizet PerlIOgetbufsiz(PerlIO *f);\nPerlIO *PerlIOimportFILE(FILE *stdio, const char *mode);\nFILE   *PerlIOexportFILE(PerlIO *f, const char *mode);\nFILE   *PerlIOfindFILE(PerlIO *f);\nvoid    PerlIOreleaseFILE(PerlIO *f,FILE *stdio);\nint     PerlIOapplylayers(PerlIO *f, const char *mode,\nconst char *layers);\nint     PerlIObinmode(PerlIO *f, int ptype, int imode,\nconst char *layers);\nvoid    PerlIOdebug(const char *fmt,...);\n\n## DESCRIPTION\n\nPerl's source code, and extensions that want maximum portability, should use the above\nfunctions instead of those defined in ANSI C's stdio.h.  The perl headers (in particular\n\"perlio.h\") will \"#define\" them to the I/O mechanism selected at Configure time.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "perlapio",
        "section": "",
        "mode": "man",
        "summary": "perlapio - perl's IO abstraction interface.",
        "synopsis": "#define PERLIONOTSTDIO 0    /* For co-existence with stdio only */\n#include <perlio.h>           /* Usually via #include <perl.h> */\nPerlIO *PerlIOstdin(void);\nPerlIO *PerlIOstdout(void);\nPerlIO *PerlIOstderr(void);\nPerlIO *PerlIOopen(const char *path,const char *mode);\nPerlIO *PerlIOfdopen(int fd, const char *mode);\nPerlIO *PerlIOreopen(const char *path, /* deprecated */\nconst char *mode, PerlIO *old);\nint     PerlIOclose(PerlIO *f);\nint     PerlIOstdoutf(const char *fmt,...)\nint     PerlIOputs(PerlIO *f,const char *string);\nint     PerlIOputc(PerlIO *f,int ch);\nSSizet PerlIOwrite(PerlIO *f,const void *buf,sizet numbytes);\nint     PerlIOprintf(PerlIO *f, const char *fmt,...);\nint     PerlIOvprintf(PerlIO *f, const char *fmt, valist args);\nint     PerlIOflush(PerlIO *f);\nint     PerlIOeof(PerlIO *f);\nint     PerlIOerror(PerlIO *f);\nvoid    PerlIOclearerr(PerlIO *f);\nint     PerlIOgetc(PerlIO *d);\nint     PerlIOungetc(PerlIO *f,int ch);\nSSizet PerlIOread(PerlIO *f, void *buf, sizet numbytes);\nint     PerlIOfileno(PerlIO *f);\nvoid    PerlIOsetlinebuf(PerlIO *f);\nOfft   PerlIOtell(PerlIO *f);\nint     PerlIOseek(PerlIO *f, Offt offset, int whence);\nvoid    PerlIOrewind(PerlIO *f);\nint     PerlIOgetpos(PerlIO *f, SV *save);    /* prototype changed */\nint     PerlIOsetpos(PerlIO *f, SV *saved);   /* prototype changed */\nint     PerlIOfastgets(PerlIO *f);\nint     PerlIOhascntptr(PerlIO *f);\nSSizet PerlIOgetcnt(PerlIO *f);\nchar   *PerlIOgetptr(PerlIO *f);\nvoid    PerlIOsetptrcnt(PerlIO *f, char *ptr, SSizet count);\nint     PerlIOcansetcnt(PerlIO *f);              /* deprecated */\nvoid    PerlIOsetcnt(PerlIO *f, int count);      /* deprecated */\nint     PerlIOhasbase(PerlIO *f);\nchar   *PerlIOgetbase(PerlIO *f);\nSSizet PerlIOgetbufsiz(PerlIO *f);\nPerlIO *PerlIOimportFILE(FILE *stdio, const char *mode);\nFILE   *PerlIOexportFILE(PerlIO *f, const char *mode);\nFILE   *PerlIOfindFILE(PerlIO *f);\nvoid    PerlIOreleaseFILE(PerlIO *f,FILE *stdio);\nint     PerlIOapplylayers(PerlIO *f, const char *mode,\nconst char *layers);\nint     PerlIObinmode(PerlIO *f, int ptype, int imode,\nconst char *layers);\nvoid    PerlIOdebug(const char *fmt,...);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 64,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 342,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "perlapio - perl's IO abstraction interface.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "#define PERLIONOTSTDIO 0    /* For co-existence with stdio only */\n#include <perlio.h>           /* Usually via #include <perl.h> */\n\nPerlIO *PerlIOstdin(void);\nPerlIO *PerlIOstdout(void);\nPerlIO *PerlIOstderr(void);\n\nPerlIO *PerlIOopen(const char *path,const char *mode);\nPerlIO *PerlIOfdopen(int fd, const char *mode);\nPerlIO *PerlIOreopen(const char *path, /* deprecated */\nconst char *mode, PerlIO *old);\nint     PerlIOclose(PerlIO *f);\n\nint     PerlIOstdoutf(const char *fmt,...)\nint     PerlIOputs(PerlIO *f,const char *string);\nint     PerlIOputc(PerlIO *f,int ch);\nSSizet PerlIOwrite(PerlIO *f,const void *buf,sizet numbytes);\nint     PerlIOprintf(PerlIO *f, const char *fmt,...);\nint     PerlIOvprintf(PerlIO *f, const char *fmt, valist args);\nint     PerlIOflush(PerlIO *f);\n\nint     PerlIOeof(PerlIO *f);\nint     PerlIOerror(PerlIO *f);\nvoid    PerlIOclearerr(PerlIO *f);\n\nint     PerlIOgetc(PerlIO *d);\nint     PerlIOungetc(PerlIO *f,int ch);\nSSizet PerlIOread(PerlIO *f, void *buf, sizet numbytes);\n\nint     PerlIOfileno(PerlIO *f);\n\nvoid    PerlIOsetlinebuf(PerlIO *f);\n\nOfft   PerlIOtell(PerlIO *f);\nint     PerlIOseek(PerlIO *f, Offt offset, int whence);\nvoid    PerlIOrewind(PerlIO *f);\n\nint     PerlIOgetpos(PerlIO *f, SV *save);    /* prototype changed */\nint     PerlIOsetpos(PerlIO *f, SV *saved);   /* prototype changed */\n\nint     PerlIOfastgets(PerlIO *f);\nint     PerlIOhascntptr(PerlIO *f);\nSSizet PerlIOgetcnt(PerlIO *f);\nchar   *PerlIOgetptr(PerlIO *f);\nvoid    PerlIOsetptrcnt(PerlIO *f, char *ptr, SSizet count);\n\nint     PerlIOcansetcnt(PerlIO *f);              /* deprecated */\nvoid    PerlIOsetcnt(PerlIO *f, int count);      /* deprecated */\n\nint     PerlIOhasbase(PerlIO *f);\nchar   *PerlIOgetbase(PerlIO *f);\nSSizet PerlIOgetbufsiz(PerlIO *f);\n\nPerlIO *PerlIOimportFILE(FILE *stdio, const char *mode);\nFILE   *PerlIOexportFILE(PerlIO *f, const char *mode);\nFILE   *PerlIOfindFILE(PerlIO *f);\nvoid    PerlIOreleaseFILE(PerlIO *f,FILE *stdio);\n\nint     PerlIOapplylayers(PerlIO *f, const char *mode,\nconst char *layers);\nint     PerlIObinmode(PerlIO *f, int ptype, int imode,\nconst char *layers);\nvoid    PerlIOdebug(const char *fmt,...);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Perl's source code, and extensions that want maximum portability, should use the above\nfunctions instead of those defined in ANSI C's stdio.h.  The perl headers (in particular\n\"perlio.h\") will \"#define\" them to the I/O mechanism selected at Configure time.\n\nThe functions are modeled on those in stdio.h, but parameter order has been \"tidied up a\nlittle\".\n\n\"PerlIO *\" takes the place of FILE *. Like FILE * it should be treated as opaque (it is\nprobably safe to assume it is a pointer to something).\n\nThere are currently two implementations:\n\n1. USESTDIO\nAll above are #define'd to stdio functions or are trivial wrapper functions which call\nstdio. In this case only PerlIO * is a FILE *.  This has been the default implementation\nsince the abstraction was introduced in perl5.00302.\n\n2. USEPERLIO\nIntroduced just after perl5.7.0, this is a re-implementation of the above abstraction\nwhich allows perl more control over how IO is done as it decouples IO from the way the\noperating system and C library choose to do things. For USEPERLIO PerlIO * has an extra\nlayer of indirection - it is a pointer-to-a-pointer.  This allows the PerlIO * to remain\nwith a known value while swapping the implementation around underneath at run time. In\nthis case all the above are true (but very simple) functions which call the underlying\nimplementation.\n\nThis is the only implementation for which \"PerlIOapplylayers()\" does anything\n\"interesting\".\n\nThe USEPERLIO implementation is described in perliol.\n\nBecause \"perlio.h\" is a thin layer (for efficiency) the semantics of these functions are\nsomewhat dependent on the underlying implementation.  Where these variations are understood\nthey are noted below.\n\nUnless otherwise noted, functions return 0 on success, or a negative value (usually \"EOF\"\nwhich is usually -1) and set \"errno\" on error.\n\nPerlIOstdin(), PerlIOstdout(), PerlIOstderr()\nUse these rather than \"stdin\", \"stdout\", \"stderr\". They are written to look like\n\"function calls\" rather than variables because this makes it easier to make them function\ncalls if platform cannot export data to loaded modules, or if (say) different \"threads\"\nmight have different values.\n\nPerlIOopen(path, mode), PerlIOfdopen(fd,mode)\nThese correspond to fopen()/fdopen() and the arguments are the same.  Return \"NULL\" and\nset \"errno\" if there is an error.  There may be an implementation limit on the number of\nopen handles, which may be lower than the limit on the number of open files - \"errno\" may\nnot be set when \"NULL\" is returned if this limit is exceeded.\n\nPerlIOreopen(path,mode,f)\nWhile this currently exists in both implementations, perl itself does not use it. As perl\ndoes not use it, it is not well tested.\n\nPerl prefers to \"dup\" the new low-level descriptor to the descriptor used by the existing\nPerlIO. This may become the behaviour of this function in the future.\n\nPerlIOprintf(f,fmt,...), PerlIOvprintf(f,fmt,a)\nThese are fprintf()/vfprintf() equivalents.\n\nPerlIOstdoutf(fmt,...)\nThis is printf() equivalent. printf is #defined to this function, so it is (currently)\nlegal to use \"printf(fmt,...)\" in perl sources.\n\nPerlIOread(f,buf,count), PerlIOwrite(f,buf,count)\nThese correspond functionally to fread() and fwrite() but the arguments and return values\nare different.  The PerlIOread() and PerlIOwrite() signatures have been modeled on the\nmore sane low level read() and write() functions instead: The \"file\" argument is passed\nfirst, there is only one \"count\", and the return value can distinguish between error and\n\"EOF\".\n\nReturns a byte count if successful (which may be zero or positive), returns negative\nvalue and sets \"errno\" on error.  Depending on implementation \"errno\" may be \"EINTR\" if\noperation was interrupted by a signal.\n\nPerlIOclose(f)\nDepending on implementation \"errno\" may be \"EINTR\" if operation was interrupted by a\nsignal.\n\nPerlIOputs(f,s), PerlIOputc(f,c)\nThese correspond to fputs() and fputc().  Note that arguments have been revised to have\n\"file\" first.\n\nPerlIOungetc(f,c)\nThis corresponds to ungetc().  Note that arguments have been revised to have \"file\"\nfirst.  Arranges that next read operation will return the byte c.  Despite the implied\n\"character\" in the name only values in the range 0..0xFF are defined. Returns the byte c\non success or -1 (\"EOF\") on error.  The number of bytes that can be \"pushed back\" may\nvary, only 1 character is certain, and then only if it is the last character that was\nread from the handle.\n\nPerlIOgetc(f)\nThis corresponds to getc().  Despite the c in the name only byte range 0..0xFF is\nsupported.  Returns the character read or -1 (\"EOF\") on error.\n\nPerlIOeof(f)\nThis corresponds to feof().  Returns a true/false indication of whether the handle is at\nend of file.  For terminal devices this may or may not be \"sticky\" depending on the\nimplementation.  The flag is cleared by PerlIOseek(), or PerlIOrewind().\n\nPerlIOerror(f)\nThis corresponds to ferror().  Returns a true/false indication of whether there has been\nan IO error on the handle.\n\nPerlIOfileno(f)\nThis corresponds to fileno(), note that on some platforms, the meaning of \"fileno\" may\nnot match Unix. Returns -1 if the handle has no open descriptor associated with it.\n\nPerlIOclearerr(f)\nThis corresponds to clearerr(), i.e., clears 'error' and (usually) 'eof' flags for the\n\"stream\". Does not return a value.\n\nPerlIOflush(f)\nThis corresponds to fflush().  Sends any buffered write data to the underlying file.  If\ncalled with \"NULL\" this may flush all open streams (or core dump with some USESTDIO\nimplementations).  Calling on a handle open for read only, or on which last operation was\na read of some kind may lead to undefined behaviour on some USESTDIO implementations.\nThe USEPERLIO (layers) implementation tries to behave better: it flushes all open\nstreams when passed \"NULL\", and attempts to retain data on read streams either in the\nbuffer or by seeking the handle to the current logical position.\n\nPerlIOseek(f,offset,whence)\nThis corresponds to fseek().  Sends buffered write data to the underlying file, or\ndiscards any buffered read data, then positions the file descriptor as specified by\noffset and whence (sic).  This is the correct thing to do when switching between read and\nwrite on the same handle (see issues with PerlIOflush() above).  Offset is of type\n\"Offt\" which is a perl Configure value which may not be same as stdio's \"offt\".\n\nPerlIOtell(f)\nThis corresponds to ftell().  Returns the current file position, or (Offt) -1 on error.\nMay just return value system \"knows\" without making a system call or checking the\nunderlying file descriptor (so use on shared file descriptors is not safe without a\nPerlIOseek()). Return value is of type \"Offt\" which is a perl Configure value which may\nnot be same as stdio's \"offt\".\n\nPerlIOgetpos(f,p), PerlIOsetpos(f,p)\nThese correspond (loosely) to fgetpos() and fsetpos(). Rather than stdio's Fpost they\nexpect a \"Perl Scalar Value\" to be passed. What is stored there should be considered\nopaque. The layout of the data may vary from handle to handle.  When not using stdio or\nif platform does not have the stdio calls then they are implemented in terms of\nPerlIOtell() and PerlIOseek().\n\nPerlIOrewind(f)\nThis corresponds to rewind(). It is usually defined as being\n\nPerlIOseek(f,(Offt)0L, SEEKSET);\nPerlIOclearerr(f);\n\nPerlIOtmpfile()\nThis corresponds to tmpfile(), i.e., returns an anonymous PerlIO or NULL on error.  The\nsystem will attempt to automatically delete the file when closed.  On Unix the file is\nusually \"unlink\"-ed just after it is created so it does not matter how it gets closed. On\nother systems the file may only be deleted if closed via PerlIOclose() and/or the\nprogram exits via \"exit\".  Depending on the implementation there may be \"race conditions\"\nwhich allow other processes access to the file, though in general it will be safer in\nthis regard than ad. hoc. schemes.\n\nPerlIOsetlinebuf(f)\nThis corresponds to setlinebuf().  Does not return a value. What constitutes a \"line\" is\nimplementation dependent but usually means that writing \"\\n\" flushes the buffer.  What\nhappens with things like \"this\\nthat\" is uncertain.  (Perl core uses it only when\n\"dumping\"; it has nothing to do with $| auto-flush.)\n\nCo-existence with stdio\nThere is outline support for co-existence of PerlIO with stdio.  Obviously if PerlIO is\nimplemented in terms of stdio there is no problem. However in other cases then mechanisms\nmust exist to create a FILE * which can be passed to library code which is going to use stdio\ncalls.\n\nThe first step is to add this line:\n\n#define PERLIONOTSTDIO 0\n\nbefore including any perl header files. (This will probably become the default at some\npoint).  That prevents \"perlio.h\" from attempting to #define stdio functions onto PerlIO\nfunctions.\n\nXS code is probably better using \"typemap\" if it expects FILE * arguments.  The standard\ntypemap will be adjusted to comprehend any changes in this area.\n\nPerlIOimportFILE(f,mode)\nUsed to get a PerlIO * from a FILE *.\n\nThe mode argument should be a string as would be passed to fopen/PerlIOopen.  If it is\nNULL then - for legacy support - the code will (depending upon the platform and the\nimplementation) either attempt to empirically determine the mode in which f is open, or\nuse \"r+\" to indicate a read/write stream.\n\nOnce called the FILE * should ONLY be closed by calling \"PerlIOclose()\" on the returned\nPerlIO *.\n\nThe PerlIO is set to textmode. Use PerlIObinmode if this is not the desired mode.\n\nThis is not the reverse of PerlIOexportFILE().\n\nPerlIOexportFILE(f,mode)\nGiven a PerlIO * create a 'native' FILE * suitable for passing to code expecting to be\ncompiled and linked with ANSI C stdio.h.  The mode argument should be a string as would\nbe passed to fopen/PerlIOopen.  If it is NULL then - for legacy support - the FILE * is\nopened in same mode as the PerlIO *.\n\nThe fact that such a FILE * has been 'exported' is recorded, (normally by pushing a new\n:stdio \"layer\" onto the PerlIO *), which may affect future PerlIO operations on the\noriginal PerlIO *.  You should not call \"fclose()\" on the file unless you call\n\"PerlIOreleaseFILE()\" to disassociate it from the PerlIO *.  (Do not use\nPerlIOimportFILE() for doing the disassociation.)\n\nCalling this function repeatedly will create a FILE * on each call (and will push an\n:stdio layer each time as well).\n\nPerlIOreleaseFILE(p,f)\nCalling PerlIOreleaseFILE informs PerlIO that all use of FILE * is complete. It is\nremoved from the list of 'exported' FILE *s, and the associated PerlIO * should revert to\nits original behaviour.\n\nUse this to disassociate a file from a PerlIO * that was associated using\nPerlIOexportFILE().\n\nPerlIOfindFILE(f)\nReturns a native FILE * used by a stdio layer. If there is none, it will create one with\nPerlIOexportFILE. In either case the FILE * should be considered as belonging to PerlIO\nsubsystem and should only be closed by calling \"PerlIOclose()\".\n\n\"Fast gets\" Functions\nIn addition to standard-like API defined so far above there is an \"implementation\" interface\nwhich allows perl to get at internals of PerlIO.  The following calls correspond to the\nvarious FILExxx macros determined by Configure - or their equivalent in other\nimplementations. This section is really of interest to only those concerned with detailed\nperl-core behaviour, implementing a PerlIO mapping or writing code which can make use of the\n\"read ahead\" that has been done by the IO system in the same way perl does. Note that any\ncode that uses these interfaces must be prepared to do things the traditional way if a handle\ndoes not support them.\n\nPerlIOfastgets(f)\nReturns true if implementation has all the interfaces required to allow perl's \"svgets\"\nto \"bypass\" normal IO mechanism.  This can vary from handle to handle.\n\nPerlIOfastgets(f) = PerlIOhascntptr(f) && \\\nPerlIOcansetcnt(f) && \\\n'Can set pointer into buffer'\n\nPerlIOhascntptr(f)\nImplementation can return pointer to current position in the \"buffer\" and a count of\nbytes available in the buffer.  Do not use this - use PerlIOfastgets.\n\nPerlIOgetcnt(f)\nReturn count of readable bytes in the buffer. Zero or negative return means no more bytes\navailable.\n\nPerlIOgetptr(f)\nReturn pointer to next readable byte in buffer, accessing via the pointer (dereferencing)\nis only safe if PerlIOgetcnt() has returned a positive value.  Only positive offsets up\nto value returned by PerlIOgetcnt() are allowed.\n\nPerlIOsetptrcnt(f,p,c)\nSet pointer into buffer, and a count of bytes still in the buffer. Should be used only to\nset pointer to within range implied by previous calls to \"PerlIOgetptr\" and\n\"PerlIOgetcnt\". The two values must be consistent with each other (implementation may\nonly use one or the other or may require both).\n\nPerlIOcansetcnt(f)\nImplementation can adjust its idea of number of bytes in the buffer.  Do not use this -\nuse PerlIOfastgets.\n\nPerlIOsetcnt(f,c)\nObscure - set count of bytes in the buffer. Deprecated.  Only usable if\nPerlIOcansetcnt() returns true.  Currently used in only doio.c to force count less than\n-1 to -1.  Perhaps should be PerlIOsetempty or similar.  This call may actually do\nnothing if \"count\" is deduced from pointer and a \"limit\".  Do not use this - use\nPerlIOsetptrcnt().\n\nPerlIOhasbase(f)\nReturns true if implementation has a buffer, and can return pointer to whole buffer and\nits size. Used by perl for -T / -B tests.  Other uses would be very obscure...\n\nPerlIOgetbase(f)\nReturn start of buffer. Access only positive offsets in the buffer up to the value\nreturned by PerlIOgetbufsiz().\n\nPerlIOgetbufsiz(f)\nReturn the total number of bytes in the buffer, this is neither the number that can be\nread, nor the amount of memory allocated to the buffer. Rather it is what the operating\nsystem and/or implementation happened to \"read()\" (or whatever) last time IO was\nrequested.\n\nOther Functions\nPerlIOapplylayers(f,mode,layers)\nThe new interface to the USEPERLIO implementation. The layers \":crlf\" and \":raw\" are\nonly ones allowed for other implementations and those are silently ignored. (As of\nperl5.8 \":raw\" is deprecated.)  Use PerlIObinmode() below for the portable case.\n\nPerlIObinmode(f,ptype,imode,layers)\nThe hook used by perl's \"binmode\" operator.  ptype is perl's character for the kind of\nIO:\n\n'<' read\n'>' write\n'+' read/write\n\nimode is \"OBINARY\" or \"OTEXT\".\n\nlayers is a string of layers to apply, only \":crlf\" makes sense in the non USEPERLIO\ncase. (As of perl5.8 \":raw\" is deprecated in favour of passing NULL.)\n\nPortable cases are:\n\nPerlIObinmode(f,ptype,OBINARY,NULL);\nand\nPerlIObinmode(f,ptype,OTEXT,\":crlf\");\n\nOn Unix these calls probably have no effect whatsoever.  Elsewhere they alter \"\\n\" to\nCR,LF translation and possibly cause a special text \"end of file\" indicator to be written\nor honoured on read. The effect of making the call after doing any IO to the handle\ndepends on the implementation. (It may be ignored, affect any data which is already\nbuffered as well, or only apply to subsequent data.)\n\nPerlIOdebug(fmt,...)\nPerlIOdebug is a printf()-like function which can be used for debugging.  No return\nvalue. Its main use is inside PerlIO where using real printf, warn() etc. would\nrecursively call PerlIO and be a problem.\n\nPerlIOdebug writes to the file named by $ENV{'PERLIODEBUG'} or defaults to stderr if\nthe environment variable is not defined. Typical use might be\n\nBourne shells (sh, ksh, bash, zsh, ash, ...):\nPERLIODEBUG=/tmp/perliodebug.log ./perl -Di somescript some args\n\nCsh/Tcsh:\nsetenv PERLIODEBUG /tmp/perliodebug.log\n./perl -Di somescript some args\n\nIf you have the \"env\" utility:\nenv PERLIODEBUG=/tmp/perliodebug.log ./perl -Di somescript args\n\nWin32:\nset PERLIODEBUG=perliodebug.log\nperl -Di somescript some args\n\nOn a Perl built without \"-DDEBUGGING\", or when the \"-Di\" command-line switch is not\nspecified, or under taint, PerlIOdebug() is a no-op.\n\nperl v5.34.0                                2025-07-25                                PERLAPIO(1)",
                "subsections": []
            }
        }
    }
}