Current Path : /compat/linux/proc/self/root/usr/opt/perl530/man/man3/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/self/root/usr/opt/perl530/man/man3/IO::Zlib.3 |
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .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" '' . ds C` . ds C' '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 >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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::Zlib 3" .TH IO::Zlib 3 "2019-10-24" "perl v5.30.2" "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::Zlib \- IO:: style interface to Compress::Zlib .SH "SYNOPSIS" .IX Header "SYNOPSIS" With any version of Perl 5 you can use the basic \s-1OO\s0 interface: .PP .Vb 1 \& use IO::Zlib; \& \& $fh = new IO::Zlib; \& if ($fh\->open("file.gz", "rb")) { \& print <$fh>; \& $fh\->close; \& } \& \& $fh = IO::Zlib\->new("file.gz", "wb9"); \& if (defined $fh) { \& print $fh "bar\en"; \& $fh\->close; \& } \& \& $fh = IO::Zlib\->new("file.gz", "rb"); \& if (defined $fh) { \& print <$fh>; \& undef $fh; # automatically closes the file \& } .Ve .PP With Perl 5.004 you can also use the \s-1TIEHANDLE\s0 interface to access compressed files just like ordinary files: .PP .Vb 1 \& use IO::Zlib; \& \& tie *FILE, \*(AqIO::Zlib\*(Aq, "file.gz", "wb"; \& print FILE "line 1\enline2\en"; \& \& tie *FILE, \*(AqIO::Zlib\*(Aq, "file.gz", "rb"; \& while (<FILE>) { print "LINE: ", $_ }; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`IO::Zlib\*(C'\fR provides an \s-1IO::\s0 style interface to Compress::Zlib and hence to gzip/zlib compressed files. It provides many of the same methods as the IO::Handle interface. .PP Starting from IO::Zlib version 1.02, IO::Zlib can also use an external \fIgzip\fR command. The default behaviour is to try to use an external \fIgzip\fR if no \f(CW\*(C`Compress::Zlib\*(C'\fR can be loaded, unless explicitly disabled by .PP .Vb 1 \& use IO::Zlib qw(:gzip_external 0); .Ve .PP If explicitly enabled by .PP .Vb 1 \& use IO::Zlib qw(:gzip_external 1); .Ve .PP then the external \fIgzip\fR is used \fBinstead\fR of \f(CW\*(C`Compress::Zlib\*(C'\fR. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .IP "new ( [\s-1ARGS\s0] )" 4 .IX Item "new ( [ARGS] )" Creates an \f(CW\*(C`IO::Zlib\*(C'\fR object. If it receives any parameters, they are passed to the method \f(CW\*(C`open\*(C'\fR; if the open fails, the object is destroyed. Otherwise, it is returned to the caller. .SH "OBJECT METHODS" .IX Header "OBJECT METHODS" .IP "open ( \s-1FILENAME, MODE\s0 )" 4 .IX Item "open ( FILENAME, MODE )" \&\f(CW\*(C`open\*(C'\fR takes two arguments. The first is the name of the file to open and the second is the open mode. The mode can be anything acceptable to Compress::Zlib and by extension anything acceptable to \fIzlib\fR (that basically means \s-1POSIX\s0 \fBfopen()\fR style mode strings plus an optional number to indicate the compression level). .IP "opened" 4 .IX Item "opened" Returns true if the object currently refers to a opened file. .IP "close" 4 .IX Item "close" Close the file associated with the object and disassociate the file from the handle. Done automatically on destroy. .IP "getc" 4 .IX Item "getc" Return the next character from the file, or undef if none remain. .IP "getline" 4 .IX Item "getline" Return the next line from the file, or undef on end of string. Can safely be called in an array context. Currently ignores $/ ($INPUT_RECORD_SEPARATOR or \f(CW$RS\fR when English is in use) and treats lines as delimited by \*(L"\en\*(R". .IP "getlines" 4 .IX Item "getlines" Get all remaining lines from the file. It will \fBcroak()\fR if accidentally called in a scalar context. .IP "print ( \s-1ARGS...\s0 )" 4 .IX Item "print ( ARGS... )" Print \s-1ARGS\s0 to the file. .IP "read ( \s-1BUF, NBYTES,\s0 [\s-1OFFSET\s0] )" 4 .IX Item "read ( BUF, NBYTES, [OFFSET] )" Read some bytes from the file. Returns the number of bytes actually read, 0 on end-of-file, undef on error. .IP "eof" 4 .IX Item "eof" Returns true if the handle is currently positioned at end of file? .IP "seek ( \s-1OFFSET, WHENCE\s0 )" 4 .IX Item "seek ( OFFSET, WHENCE )" Seek to a given position in the stream. Not yet supported. .IP "tell" 4 .IX Item "tell" Return the current position in the stream, as a numeric offset. Not yet supported. .IP "setpos ( \s-1POS\s0 )" 4 .IX Item "setpos ( POS )" Set the current position, using the opaque value returned by \f(CW\*(C`getpos()\*(C'\fR. Not yet supported. .IP "getpos ( \s-1POS\s0 )" 4 .IX Item "getpos ( POS )" Return the current position in the string, as an opaque object. Not yet supported. .SH "USING THE EXTERNAL GZIP" .IX Header "USING THE EXTERNAL GZIP" If the external \fIgzip\fR is used, the following \f(CW\*(C`open\*(C'\fRs are used: .PP .Vb 2 \& open(FH, "gzip \-dc $filename |") # for read opens \& open(FH, " | gzip > $filename") # for write opens .Ve .PP You can modify the 'commands' for example to hardwire an absolute path by e.g. .PP .Vb 2 \& use IO::Zlib \*(Aq:gzip_read_open\*(Aq => \*(Aq/some/where/gunzip \-c %s |\*(Aq; \& use IO::Zlib \*(Aq:gzip_write_open\*(Aq => \*(Aq| /some/where/gzip.exe > %s\*(Aq; .Ve .PP The \f(CW%s\fR is expanded to be the filename (\f(CW\*(C`sprintf\*(C'\fR is used, so be careful to escape any other \f(CW\*(C`%\*(C'\fR signs). The 'commands' are checked for sanity \- they must contain the \f(CW%s\fR, and the read open must end with the pipe sign, and the write open must begin with the pipe sign. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .IP "has_Compress_Zlib" 4 .IX Item "has_Compress_Zlib" Returns true if \f(CW\*(C`Compress::Zlib\*(C'\fR is available. Note that this does not mean that \f(CW\*(C`Compress::Zlib\*(C'\fR is being used: see \*(L"gzip_external\*(R" and gzip_used. .IP "gzip_external" 4 .IX Item "gzip_external" Undef if an external \fIgzip\fR \fBcan\fR be used if \f(CW\*(C`Compress::Zlib\*(C'\fR is not available (see \*(L"has_Compress_Zlib\*(R"), true if an external \fIgzip\fR is explicitly used, false if an external \fIgzip\fR must not be used. See \*(L"gzip_used\*(R". .IP "gzip_used" 4 .IX Item "gzip_used" True if an external \fIgzip\fR is being used, false if not. .IP "gzip_read_open" 4 .IX Item "gzip_read_open" Return the 'command' being used for opening a file for reading using an external \fIgzip\fR. .IP "gzip_write_open" 4 .IX Item "gzip_write_open" Return the 'command' being used for opening a file for writing using an external \fIgzip\fR. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" .IP "IO::Zlib::getlines: must be called in list context" 4 .IX Item "IO::Zlib::getlines: must be called in list context" If you want read lines, you must read in list context. .IP "IO::Zlib::gzopen_external: mode '...' is illegal" 4 .IX Item "IO::Zlib::gzopen_external: mode '...' is illegal" Use only modes 'rb' or 'wb' or /wb[1\-9]/. .IP "IO::Zlib::import: '...' is illegal" 4 .IX Item "IO::Zlib::import: '...' is illegal" The known import symbols are the \f(CW\*(C`:gzip_external\*(C'\fR, \f(CW\*(C`:gzip_read_open\*(C'\fR, and \f(CW\*(C`:gzip_write_open\*(C'\fR. Anything else is not recognized. .IP "IO::Zlib::import: ':gzip_external' requires an argument" 4 .IX Item "IO::Zlib::import: ':gzip_external' requires an argument" The \f(CW\*(C`:gzip_external\*(C'\fR requires one boolean argument. .IP "IO::Zlib::import: 'gzip_read_open' requires an argument" 4 .IX Item "IO::Zlib::import: 'gzip_read_open' requires an argument" The \f(CW\*(C`:gzip_external\*(C'\fR requires one string argument. .IP "IO::Zlib::import: 'gzip_read' '...' is illegal" 4 .IX Item "IO::Zlib::import: 'gzip_read' '...' is illegal" The \f(CW\*(C`:gzip_read_open\*(C'\fR argument must end with the pipe sign (|) and have the \f(CW%s\fR for the filename. See \*(L"\s-1USING THE EXTERNAL GZIP\*(R"\s0. .IP "IO::Zlib::import: 'gzip_write_open' requires an argument" 4 .IX Item "IO::Zlib::import: 'gzip_write_open' requires an argument" The \f(CW\*(C`:gzip_external\*(C'\fR requires one string argument. .IP "IO::Zlib::import: 'gzip_write_open' '...' is illegal" 4 .IX Item "IO::Zlib::import: 'gzip_write_open' '...' is illegal" The \f(CW\*(C`:gzip_write_open\*(C'\fR argument must begin with the pipe sign (|) and have the \f(CW%s\fR for the filename. An output redirect (>) is also often a good idea, depending on your operating system shell syntax. See \*(L"\s-1USING THE EXTERNAL GZIP\*(R"\s0. .IP "IO::Zlib::import: no Compress::Zlib and no external gzip" 4 .IX Item "IO::Zlib::import: no Compress::Zlib and no external gzip" Given that we failed to load \f(CW\*(C`Compress::Zlib\*(C'\fR and that the use of an external \fIgzip\fR was disabled, IO::Zlib has not much chance of working. .IP "IO::Zlib::open: needs a filename" 4 .IX Item "IO::Zlib::open: needs a filename" No filename, no open. .IP "IO::Zlib::READ: \s-1NBYTES\s0 must be specified" 4 .IX Item "IO::Zlib::READ: NBYTES must be specified" We must know how much to read. .IP "IO::Zlib::WRITE: too long \s-1LENGTH\s0" 4 .IX Item "IO::Zlib::WRITE: too long LENGTH" The \s-1LENGTH\s0 must be less than or equal to the buffer size. .SH "SEE ALSO" .IX Header "SEE ALSO" perlfunc, \&\*(L"I/O Operators\*(R" in perlop, IO::Handle, Compress::Zlib .SH "HISTORY" .IX Header "HISTORY" Created by Tom Hughes <\fItom@compton.nu\fR>. .PP Support for external gzip added by Jarkko Hietaniemi <\fIjhi@iki.fi\fR>. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 1998\-2004 Tom Hughes <\fItom@compton.nu\fR>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.