⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 io::handle.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "IO::Handle 3".TH IO::Handle 3 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"IO::Handle \- supply object methods for I/O handles.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\&    use IO::Handle;\&\&    $io = new IO::Handle;\&    if ($io\->fdopen(fileno(STDIN),"r")) {\&        print $io\->getline;\&        $io\->close;\&    }\&\&    $io = new IO::Handle;\&    if ($io\->fdopen(fileno(STDOUT),"w")) {\&        $io\->print("Some text\en");\&    }\&\&    # setvbuf is not available by default on Perls 5.8.0 and later.\&    use IO::Handle \*(Aq_IOLBF\*(Aq;\&    $io\->setvbuf($buffer_var, _IOLBF, 1024);\&\&    undef $io;       # automatically closes the file if it\*(Aqs open\&\&    autoflush STDOUT 1;.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"\&\f(CW\*(C`IO::Handle\*(C'\fR is the base class for all other \s-1IO\s0 handle classes. It isnot intended that objects of \f(CW\*(C`IO::Handle\*(C'\fR would be created directly,but instead \f(CW\*(C`IO::Handle\*(C'\fR is inherited from by several other classesin the \s-1IO\s0 hierarchy..PPIf you are reading this documentation, looking for a replacement forthe \f(CW\*(C`FileHandle\*(C'\fR package, then I suggest you read the documentationfor \f(CW\*(C`IO::File\*(C'\fR too..SH "CONSTRUCTOR".IX Header "CONSTRUCTOR".IP "new ()" 4.IX Item "new ()"Creates a new \f(CW\*(C`IO::Handle\*(C'\fR object..IP "new_from_fd ( \s-1FD\s0, \s-1MODE\s0 )" 4.IX Item "new_from_fd ( FD, MODE )"Creates an \f(CW\*(C`IO::Handle\*(C'\fR like \f(CW\*(C`new\*(C'\fR does.It requires two parameters, which are passed to the method \f(CW\*(C`fdopen\*(C'\fR;if the fdopen fails, the object is destroyed. Otherwise, it is returnedto the caller..SH "METHODS".IX Header "METHODS"See perlfunc for complete descriptions of each of the followingsupported \f(CW\*(C`IO::Handle\*(C'\fR methods, which are just front ends for thecorresponding built-in functions:.PP.Vb 10\&    $io\->close\&    $io\->eof\&    $io\->fileno\&    $io\->format_write( [FORMAT_NAME] )\&    $io\->getc\&    $io\->read ( BUF, LEN, [OFFSET] )\&    $io\->print ( ARGS )\&    $io\->printf ( FMT, [ARGS] )\&    $io\->say ( ARGS )\&    $io\->stat\&    $io\->sysread ( BUF, LEN, [OFFSET] )\&    $io\->syswrite ( BUF, [LEN, [OFFSET]] )\&    $io\->truncate ( LEN ).Ve.PPSee perlvar for complete descriptions of each of the followingsupported \f(CW\*(C`IO::Handle\*(C'\fR methods.  All of them return the previousvalue of the attribute and takes an optional single argument that whengiven will set the value.  If no argument is given the previous valueis unchanged (except for \f(CW$io\fR\->autoflush will actually turn \s-1ON\s0autoflush by default)..PP.Vb 7\&    $io\->autoflush ( [BOOL] )                         $|\&    $io\->format_page_number( [NUM] )                  $%\&    $io\->format_lines_per_page( [NUM] )               $=\&    $io\->format_lines_left( [NUM] )                   $\-\&    $io\->format_name( [STR] )                         $~\&    $io\->format_top_name( [STR] )                     $^\&    $io\->input_line_number( [NUM])                    $..Ve.PPThe following methods are not supported on a per-filehandle basis..PP.Vb 4\&    IO::Handle\->format_line_break_characters( [STR] ) $:\&    IO::Handle\->format_formfeed( [STR])               $^L\&    IO::Handle\->output_field_separator( [STR] )       $,\&    IO::Handle\->output_record_separator( [STR] )      $\e\&\&    IO::Handle\->input_record_separator( [STR] )       $/.Ve.PPFurthermore, for doing normal I/O you might need these:.ie n .IP "$io\->fdopen ( \s-1FD\s0, \s-1MODE\s0 )" 4.el .IP "\f(CW$io\fR\->fdopen ( \s-1FD\s0, \s-1MODE\s0 )" 4.IX Item "$io->fdopen ( FD, MODE )"\&\f(CW\*(C`fdopen\*(C'\fR is like an ordinary \f(CW\*(C`open\*(C'\fR except that its first parameteris not a filename but rather a file handle name, an IO::Handle object,or a file descriptor number..ie n .IP "$io\->opened" 4.el .IP "\f(CW$io\fR\->opened" 4.IX Item "$io->opened"Returns true if the object is currently a valid file descriptor, falseotherwise..ie n .IP "$io\->getline" 4.el .IP "\f(CW$io\fR\->getline" 4.IX Item "$io->getline"This works like <$io> described in \*(L"I/O Operators\*(R" in perlopexcept that it's more readable and can be safely called in alist context but still returns just one line.  If used as the conditional+within a \f(CW\*(C`while\*(C'\fR or C\-style \f(CW\*(C`for\*(C'\fR loop, however, you will need to+emulate the functionality of <$io> with \f(CW\*(C`defined($_ = $io\->getline)\*(C'\fR..ie n .IP "$io\->getlines" 4.el .IP "\f(CW$io\fR\->getlines" 4.IX Item "$io->getlines"This works like <$io> when called in a list context to read allthe remaining lines in a file, except that it's more readable.It will also \fIcroak()\fR if accidentally called in a scalar context..ie n .IP "$io\->ungetc ( \s-1ORD\s0 )" 4.el .IP "\f(CW$io\fR\->ungetc ( \s-1ORD\s0 )" 4.IX Item "$io->ungetc ( ORD )"Pushes a character with the given ordinal value back onto the givenhandle's input stream.  Only one character of pushback per handle isguaranteed..ie n .IP "$io\->write ( \s-1BUF\s0, \s-1LEN\s0 [, \s-1OFFSET\s0 ] )" 4.el .IP "\f(CW$io\fR\->write ( \s-1BUF\s0, \s-1LEN\s0 [, \s-1OFFSET\s0 ] )" 4.IX Item "$io->write ( BUF, LEN [, OFFSET ] )"This \f(CW\*(C`write\*(C'\fR is like \f(CW\*(C`write\*(C'\fR found in C, that is it is theopposite of read. The wrapper for the perl \f(CW\*(C`write\*(C'\fR function iscalled \f(CW\*(C`format_write\*(C'\fR..ie n .IP "$io\->error" 4.el .IP "\f(CW$io\fR\->error" 4.IX Item "$io->error"Returns a true value if the given handle has experienced any errorssince it was opened or since the last call to \f(CW\*(C`clearerr\*(C'\fR, or if thehandle is invalid. It only returns false for a valid handle with nooutstanding errors..ie n .IP "$io\->clearerr" 4.el .IP "\f(CW$io\fR\->clearerr" 4.IX Item "$io->clearerr"Clear the given handle's error indicator. Returns \-1 if the handle isinvalid, 0 otherwise..ie n .IP "$io\->sync" 4.el .IP "\f(CW$io\fR\->sync" 4.IX Item "$io->sync"\&\f(CW\*(C`sync\*(C'\fR synchronizes a file's in-memory state  with  that  on thephysical medium. \f(CW\*(C`sync\*(C'\fR does not operate at the perlio api level, butoperates on the file descriptor (similar to sysread, sysseek andsystell). This means that any data held at the perlio api level will notbe synchronized. To synchronize data that is buffered at the perlio apilevel you must use the flush method. \f(CW\*(C`sync\*(C'\fR is not implemented on allplatforms. Returns \*(L"0 but true\*(R" on success, \f(CW\*(C`undef\*(C'\fR on error, \f(CW\*(C`undef\*(C'\fRfor an invalid handle. See \fIfsync\fR\|(3c)..ie n .IP "$io\->flush" 4.el .IP "\f(CW$io\fR\->flush" 4.IX Item "$io->flush"\&\f(CW\*(C`flush\*(C'\fR causes perl to flush any buffered data at the perlio api level.Any unread data in the buffer will be discarded, and any unwritten datawill be written to the underlying file descriptor. Returns \*(L"0 but true\*(R"on success, \f(CW\*(C`undef\*(C'\fR on error..ie n .IP "$io\->printflush ( \s-1ARGS\s0 )" 4.el .IP "\f(CW$io\fR\->printflush ( \s-1ARGS\s0 )" 4.IX Item "$io->printflush ( ARGS )"Turns on autoflush, print \s-1ARGS\s0 and then restores the autoflush status of the\&\f(CW\*(C`IO::Handle\*(C'\fR object. Returns the return value from print..ie n .IP "$io\->blocking ( [ \s-1BOOL\s0 ] )" 4.el .IP "\f(CW$io\fR\->blocking ( [ \s-1BOOL\s0 ] )" 4.IX Item "$io->blocking ( [ BOOL ] )"If called with an argument \f(CW\*(C`blocking\*(C'\fR will turn on non-blocking \s-1IO\s0 if\&\f(CW\*(C`BOOL\*(C'\fR is false, and turn it off if \f(CW\*(C`BOOL\*(C'\fR is true..Sp\&\f(CW\*(C`blocking\*(C'\fR will return the value of the previous setting, or thecurrent setting if \f(CW\*(C`BOOL\*(C'\fR is not given..SpIf an error occurs \f(CW\*(C`blocking\*(C'\fR will return undef and \f(CW$!\fR will be set..PPIf the C functions \fIsetbuf()\fR and/or \fIsetvbuf()\fR are available, then\&\f(CW\*(C`IO::Handle::setbuf\*(C'\fR and \f(CW\*(C`IO::Handle::setvbuf\*(C'\fR set the bufferingpolicy for an IO::Handle.  The calling sequences for the Perl functionsare the same as their C counterparts\*(--including the constants \f(CW\*(C`_IOFBF\*(C'\fR,\&\f(CW\*(C`_IOLBF\*(C'\fR, and \f(CW\*(C`_IONBF\*(C'\fR for \fIsetvbuf()\fR\-\-except that the buffer parameterspecifies a scalar variable to use as a buffer. You should onlychange the buffer before any I/O, or immediately after calling flush..PP\&\s-1WARNING:\s0 The \fIIO::Handle::setvbuf()\fR is not available by default onPerls 5.8.0 and later because \fIsetvbuf()\fR is rather specific to usingthe stdio library, while Perl prefers the new perlio subsystem instead..PP\&\s-1WARNING:\s0 A variable used as a buffer by \f(CW\*(C`setbuf\*(C'\fR or \f(CW\*(C`setvbuf\*(C'\fR \fBmust notbe modified\fR in any way until the IO::Handle is closed or \f(CW\*(C`setbuf\*(C'\fR or\&\f(CW\*(C`setvbuf\*(C'\fR is called again, or memory corruption may result! Remember thatthe order of global destruction is undefined, so even if your buffervariable remains in scope until program termination, it may be undefinedbefore the file IO::Handle is closed. Note that you need to import theconstants \f(CW\*(C`_IOFBF\*(C'\fR, \f(CW\*(C`_IOLBF\*(C'\fR, and \f(CW\*(C`_IONBF\*(C'\fR explicitly. Like C, setbufreturns nothing. setvbuf returns \*(L"0 but true\*(R", on success, \f(CW\*(C`undef\*(C'\fR onfailure..PPLastly, there is a special method for working under \fB\-T\fR and setuid/gidscripts:.ie n .IP "$io\->untaint" 4.el .IP "\f(CW$io\fR\->untaint" 4.IX Item "$io->untaint"Marks the object as taint-clean, and as such data read from it will alsobe considered taint-clean. Note that this is a very trusting action totake, and appropriate consideration for the data source and potentialvulnerability should be kept in mind. Returns 0 on success, \-1 if settingthe taint-clean flag failed. (eg invalid handle).SH "NOTE".IX Header "NOTE"An \f(CW\*(C`IO::Handle\*(C'\fR object is a reference to a symbol/GLOB reference (seethe \f(CW\*(C`Symbol\*(C'\fR package).  Some modules thatinherit from \f(CW\*(C`IO::Handle\*(C'\fR may want to keep object related variablesin the hash table part of the \s-1GLOB\s0. In an attempt to prevent modulestrampling on each other I propose the that any such module should prefixits variables with its own name separated by _'s. For example the IO::Socketmodule keeps a \f(CW\*(C`timeout\*(C'\fR variable in 'io_socket_timeout'..SH "SEE ALSO".IX Header "SEE ALSO"perlfunc, \&\*(L"I/O Operators\*(R" in perlop,IO::File.SH "BUGS".IX Header "BUGS"Due to backwards compatibility, all filehandles resemble objectsof class \f(CW\*(C`IO::Handle\*(C'\fR, or actually classes derived from that class.They actually aren't.  Which means you can't derive your own class from \f(CW\*(C`IO::Handle\*(C'\fR and inherit those methods..SH "HISTORY".IX Header "HISTORY"Derived from FileHandle.pm by Graham Barr <\fIgbarr@pobox.com\fR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -