CINXE.COM

IO::Uncompress::Inflate - Read RFC 1950 files/buffers - Perldoc Browser

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>IO::Uncompress::Inflate - Read RFC 1950 files/buffers - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/IO::Uncompress::Inflate"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/"><img src="/images/perl_camel_30.png" width="30" height="30" class="d-inline-block align-top" alt="Perl Camel Logo"> Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.18.4</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/IO::Uncompress::Inflate">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1/IO::Uncompress::Inflate">5.40.1</a> <a class="dropdown-item" href="/5.40.0/IO::Uncompress::Inflate">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3/IO::Uncompress::Inflate">5.38.3</a> <a class="dropdown-item" href="/5.38.2/IO::Uncompress::Inflate">5.38.2</a> <a class="dropdown-item" href="/5.38.1/IO::Uncompress::Inflate">5.38.1</a> <a class="dropdown-item" href="/5.38.0/IO::Uncompress::Inflate">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/IO::Uncompress::Inflate">5.36.3</a> <a class="dropdown-item" href="/5.36.2/IO::Uncompress::Inflate">5.36.2</a> <a class="dropdown-item" href="/5.36.1/IO::Uncompress::Inflate">5.36.1</a> <a class="dropdown-item" href="/5.36.0/IO::Uncompress::Inflate">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/IO::Uncompress::Inflate">5.34.3</a> <a class="dropdown-item" href="/5.34.2/IO::Uncompress::Inflate">5.34.2</a> <a class="dropdown-item" href="/5.34.1/IO::Uncompress::Inflate">5.34.1</a> <a class="dropdown-item" href="/5.34.0/IO::Uncompress::Inflate">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/IO::Uncompress::Inflate">5.32.1</a> <a class="dropdown-item" href="/5.32.0/IO::Uncompress::Inflate">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/IO::Uncompress::Inflate">5.30.3</a> <a class="dropdown-item" href="/5.30.2/IO::Uncompress::Inflate">5.30.2</a> <a class="dropdown-item" href="/5.30.1/IO::Uncompress::Inflate">5.30.1</a> <a class="dropdown-item" href="/5.30.0/IO::Uncompress::Inflate">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/IO::Uncompress::Inflate">5.28.3</a> <a class="dropdown-item" href="/5.28.2/IO::Uncompress::Inflate">5.28.2</a> <a class="dropdown-item" href="/5.28.1/IO::Uncompress::Inflate">5.28.1</a> <a class="dropdown-item" href="/5.28.0/IO::Uncompress::Inflate">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/IO::Uncompress::Inflate">5.26.3</a> <a class="dropdown-item" href="/5.26.2/IO::Uncompress::Inflate">5.26.2</a> <a class="dropdown-item" href="/5.26.1/IO::Uncompress::Inflate">5.26.1</a> <a class="dropdown-item" href="/5.26.0/IO::Uncompress::Inflate">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/IO::Uncompress::Inflate">5.24.4</a> <a class="dropdown-item" href="/5.24.3/IO::Uncompress::Inflate">5.24.3</a> <a class="dropdown-item" href="/5.24.2/IO::Uncompress::Inflate">5.24.2</a> <a class="dropdown-item" href="/5.24.1/IO::Uncompress::Inflate">5.24.1</a> <a class="dropdown-item" href="/5.24.0/IO::Uncompress::Inflate">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/IO::Uncompress::Inflate">5.22.4</a> <a class="dropdown-item" href="/5.22.3/IO::Uncompress::Inflate">5.22.3</a> <a class="dropdown-item" href="/5.22.2/IO::Uncompress::Inflate">5.22.2</a> <a class="dropdown-item" href="/5.22.1/IO::Uncompress::Inflate">5.22.1</a> <a class="dropdown-item" href="/5.22.0/IO::Uncompress::Inflate">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/IO::Uncompress::Inflate">5.20.3</a> <a class="dropdown-item" href="/5.20.2/IO::Uncompress::Inflate">5.20.2</a> <a class="dropdown-item" href="/5.20.1/IO::Uncompress::Inflate">5.20.1</a> <a class="dropdown-item" href="/5.20.0/IO::Uncompress::Inflate">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item active" href="/5.18.4/IO::Uncompress::Inflate">5.18.4</a> <a class="dropdown-item" href="/5.18.3/IO::Uncompress::Inflate">5.18.3</a> <a class="dropdown-item" href="/5.18.2/IO::Uncompress::Inflate">5.18.2</a> <a class="dropdown-item" href="/5.18.1/IO::Uncompress::Inflate">5.18.1</a> <a class="dropdown-item" href="/5.18.0/IO::Uncompress::Inflate">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/IO::Uncompress::Inflate">5.16.3</a> <a class="dropdown-item" href="/5.16.2/IO::Uncompress::Inflate">5.16.2</a> <a class="dropdown-item" href="/5.16.1/IO::Uncompress::Inflate">5.16.1</a> <a class="dropdown-item" href="/5.16.0/IO::Uncompress::Inflate">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/IO::Uncompress::Inflate">5.14.4</a> <a class="dropdown-item" href="/5.14.3/IO::Uncompress::Inflate">5.14.3</a> <a class="dropdown-item" href="/5.14.2/IO::Uncompress::Inflate">5.14.2</a> <a class="dropdown-item" href="/5.14.1/IO::Uncompress::Inflate">5.14.1</a> <a class="dropdown-item" href="/5.14.0/IO::Uncompress::Inflate">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/IO::Uncompress::Inflate">5.12.5</a> <a class="dropdown-item" href="/5.12.4/IO::Uncompress::Inflate">5.12.4</a> <a class="dropdown-item" href="/5.12.3/IO::Uncompress::Inflate">5.12.3</a> <a class="dropdown-item" href="/5.12.2/IO::Uncompress::Inflate">5.12.2</a> <a class="dropdown-item" href="/5.12.1/IO::Uncompress::Inflate">5.12.1</a> <a class="dropdown-item" href="/5.12.0/IO::Uncompress::Inflate">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/IO::Uncompress::Inflate">5.10.1</a> <a class="dropdown-item" href="/5.10.0/IO::Uncompress::Inflate">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/IO::Uncompress::Inflate">5.8.9</a> <a class="dropdown-item" href="/5.8.8/IO::Uncompress::Inflate">5.8.8</a> <a class="dropdown-item" href="/5.8.7/IO::Uncompress::Inflate">5.8.7</a> <a class="dropdown-item" href="/5.8.6/IO::Uncompress::Inflate">5.8.6</a> <a class="dropdown-item" href="/5.8.5/IO::Uncompress::Inflate">5.8.5</a> <a class="dropdown-item" href="/5.8.4/IO::Uncompress::Inflate">5.8.4</a> <a class="dropdown-item" href="/5.8.3/IO::Uncompress::Inflate">5.8.3</a> <a class="dropdown-item" href="/5.8.2/IO::Uncompress::Inflate">5.8.2</a> <a class="dropdown-item" href="/5.8.1/IO::Uncompress::Inflate">5.8.1</a> <a class="dropdown-item" href="/5.8.0/IO::Uncompress::Inflate">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/IO::Uncompress::Inflate">5.6.2</a> <a class="dropdown-item" href="/5.6.1/IO::Uncompress::Inflate">5.6.1</a> <a class="dropdown-item" href="/5.6.0/IO::Uncompress::Inflate">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/IO::Uncompress::Inflate">5.005_04</a> <a class="dropdown-item" href="/5.005_03/IO::Uncompress::Inflate">5.005_03</a> <a class="dropdown-item" href="/5.005_02/IO::Uncompress::Inflate">5.005_02</a> <a class="dropdown-item" href="/5.005_01/IO::Uncompress::Inflate">5.005_01</a> <a class="dropdown-item" href="/5.005/IO::Uncompress::Inflate">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/IO::Uncompress::Inflate">blead</a> <a class="dropdown-item" href="/5.41.9/IO::Uncompress::Inflate">5.41.9</a> <a class="dropdown-item" href="/5.41.8/IO::Uncompress::Inflate">5.41.8</a> <a class="dropdown-item" href="/5.41.7/IO::Uncompress::Inflate">5.41.7</a> <a class="dropdown-item" href="/5.41.6/IO::Uncompress::Inflate">5.41.6</a> <a class="dropdown-item" href="/5.41.5/IO::Uncompress::Inflate">5.41.5</a> <a class="dropdown-item" href="/5.41.4/IO::Uncompress::Inflate">5.41.4</a> <a class="dropdown-item" href="/5.41.3/IO::Uncompress::Inflate">5.41.3</a> <a class="dropdown-item" href="/5.41.2/IO::Uncompress::Inflate">5.41.2</a> <a class="dropdown-item" href="/5.41.1/IO::Uncompress::Inflate">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1-RC1/IO::Uncompress::Inflate">5.40.1-RC1</a> <a class="dropdown-item" href="/5.40.0-RC2/IO::Uncompress::Inflate">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/IO::Uncompress::Inflate">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/IO::Uncompress::Inflate">5.39.10</a> <a class="dropdown-item" href="/5.39.9/IO::Uncompress::Inflate">5.39.9</a> <a class="dropdown-item" href="/5.39.8/IO::Uncompress::Inflate">5.39.8</a> <a class="dropdown-item" href="/5.39.7/IO::Uncompress::Inflate">5.39.7</a> <a class="dropdown-item" href="/5.39.6/IO::Uncompress::Inflate">5.39.6</a> <a class="dropdown-item" href="/5.39.5/IO::Uncompress::Inflate">5.39.5</a> <a class="dropdown-item" href="/5.39.4/IO::Uncompress::Inflate">5.39.4</a> <a class="dropdown-item" href="/5.39.3/IO::Uncompress::Inflate">5.39.3</a> <a class="dropdown-item" href="/5.39.2/IO::Uncompress::Inflate">5.39.2</a> <a class="dropdown-item" href="/5.39.1/IO::Uncompress::Inflate">5.39.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3-RC1/IO::Uncompress::Inflate">5.38.3-RC1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.18.4/perl">Perl</a> <a class="dropdown-item" href="/5.18.4/perlintro">Intro</a> <a class="dropdown-item" href="/5.18.4/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.18.4/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.18.4/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/perlop">Operators</a> <a class="dropdown-item" href="/5.18.4/functions">Functions</a> <a class="dropdown-item" href="/5.18.4/variables">Variables</a> <a class="dropdown-item" href="/5.18.4/modules">Modules</a> <a class="dropdown-item" href="/5.18.4/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.18.4/perlcommunity">Community</a> <a class="dropdown-item" href="/5.18.4/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.18.4/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.18.4/IO::Uncompress::Inflate">IO::Uncompress::Inflate</a> <div id="more"> (<a href="/5.18.4/IO::Uncompress::Inflate.txt">source</a>, <a href="https://metacpan.org/pod/IO::Uncompress::Inflate">CPAN</a>) </div> <div id="moduleversion">version 2.060</div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.18.4. <a href="/IO::Uncompress::Inflate">View the latest version</a> </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#SYNOPSIS">SYNOPSIS</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> </li> <li> <a class="text-decoration-none" href="#Functional-Interface">Functional Interface</a> <ul> <li> <a class="text-decoration-none" href="#inflate-$input-=%3E-$output-%5B,-OPTS%5D">inflate $input =&gt; $output [, OPTS]</a> <ul> <li> <a class="text-decoration-none" href="#The-$input_filename_or_reference-parameter">The $input_filename_or_reference parameter</a> </li> <li> <a class="text-decoration-none" href="#The-$output_filename_or_reference-parameter">The $output_filename_or_reference parameter</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Notes">Notes</a> </li> <li> <a class="text-decoration-none" href="#Optional-Parameters">Optional Parameters</a> </li> <li> <a class="text-decoration-none" href="#Examples">Examples</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#OO-Interface">OO Interface</a> <ul> <li> <a class="text-decoration-none" href="#Constructor">Constructor</a> </li> <li> <a class="text-decoration-none" href="#Constructor-Options">Constructor Options</a> </li> <li> <a class="text-decoration-none" href="#Examples1">Examples</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Methods">Methods</a> <ul> <li> <a class="text-decoration-none" href="#read">read</a> </li> <li> <a class="text-decoration-none" href="#read1">read</a> </li> <li> <a class="text-decoration-none" href="#getline">getline</a> </li> <li> <a class="text-decoration-none" href="#getc">getc</a> </li> <li> <a class="text-decoration-none" href="#ungetc">ungetc</a> </li> <li> <a class="text-decoration-none" href="#inflateSync">inflateSync</a> </li> <li> <a class="text-decoration-none" href="#getHeaderInfo">getHeaderInfo</a> </li> <li> <a class="text-decoration-none" href="#tell">tell</a> </li> <li> <a class="text-decoration-none" href="#eof">eof</a> </li> <li> <a class="text-decoration-none" href="#seek">seek</a> </li> <li> <a class="text-decoration-none" href="#binmode">binmode</a> </li> <li> <a class="text-decoration-none" href="#opened">opened</a> </li> <li> <a class="text-decoration-none" href="#autoflush">autoflush</a> </li> <li> <a class="text-decoration-none" href="#input_line_number">input_line_number</a> </li> <li> <a class="text-decoration-none" href="#fileno">fileno</a> </li> <li> <a class="text-decoration-none" href="#close">close</a> </li> <li> <a class="text-decoration-none" href="#nextStream">nextStream</a> </li> <li> <a class="text-decoration-none" href="#trailingData">trailingData</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#Importing">Importing</a> </li> <li> <a class="text-decoration-none" href="#EXAMPLES">EXAMPLES</a> <ul> <li> <a class="text-decoration-none" href="#Working-with-Net::FTP">Working with Net::FTP</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#SEE-ALSO">SEE ALSO</a> </li> <li> <a class="text-decoration-none" href="#AUTHOR">AUTHOR</a> </li> <li> <a class="text-decoration-none" href="#MODIFICATION-HISTORY">MODIFICATION HISTORY</a> </li> <li> <a class="text-decoration-none" href="#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>IO::Uncompress::Inflate - Read RFC 1950 files/buffers</p> <h1 id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">#</a>SYNOPSIS</h1> <pre><code>use IO::Uncompress::Inflate qw(inflate $InflateError) ; my $status = inflate $input =&gt; $output [,OPTS] or die &quot;inflate failed: $InflateError\n&quot;; my $z = new IO::Uncompress::Inflate $input [OPTS] or die &quot;inflate failed: $InflateError\n&quot;; $status = $z-&gt;read($buffer) $status = $z-&gt;read($buffer, $length) $status = $z-&gt;read($buffer, $length, $offset) $line = $z-&gt;getline() $char = $z-&gt;getc() $char = $z-&gt;ungetc() $char = $z-&gt;opened() $status = $z-&gt;inflateSync() $data = $z-&gt;trailingData() $status = $z-&gt;nextStream() $data = $z-&gt;getHeaderInfo() $z-&gt;tell() $z-&gt;seek($position, $whence) $z-&gt;binmode() $z-&gt;fileno() $z-&gt;eof() $z-&gt;close() $InflateError ; # IO::File mode &lt;$z&gt; read($z, $buffer); read($z, $buffer, $length); read($z, $buffer, $length, $offset); tell($z) seek($z, $position, $whence) binmode($z) fileno($z) eof($z) close($z)</code></pre> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>This module provides a Perl interface that allows the reading of files/buffers that conform to RFC 1950.</p> <p>For writing RFC 1950 files/buffers, see the companion module IO::Compress::Deflate.</p> <h1 id="Functional-Interface"><a class="permalink" href="#Functional-Interface">#</a><a id="Functional"></a>Functional Interface</h1> <p>A top-level function, <code>inflate</code>, is provided to carry out &quot;one-shot&quot; uncompression between buffers and/or files. For finer control over the uncompression process, see the <a href="#OO-Interface">&quot;OO Interface&quot;</a> section.</p> <pre><code>use IO::Uncompress::Inflate qw(inflate $InflateError) ; inflate $input_filename_or_reference =&gt; $output_filename_or_reference [,OPTS] or die &quot;inflate failed: $InflateError\n&quot;;</code></pre> <p>The functional interface needs Perl5.005 or better.</p> <h2 id="inflate-$input-=&gt;-$output-[,-OPTS]"><a class="permalink" href="#inflate-$input-=%3E-$output-%5B,-OPTS%5D">#</a><a id="inflate"></a><a id="inflate-input-output-OPTS"></a>inflate $input =&gt; $output [, OPTS]</h2> <p><code>inflate</code> expects at least two parameters, <code>$input_filename_or_reference</code> and <code>$output_filename_or_reference</code>.</p> <h3 id="The-$input_filename_or_reference-parameter"><a class="permalink" href="#The-$input_filename_or_reference-parameter">#</a><a id="The"></a><a id="The-input_filename_or_reference-parameter"></a>The <code>$input_filename_or_reference</code> parameter</h3> <p>The parameter, <code>$input_filename_or_reference</code>, is used to define the source of the compressed data.</p> <p>It can take one of the following forms:</p> <dl> <dt id="A-filename"><a class="permalink" href="#A-filename">#</a><a id="A"></a>A filename</dt> <dd> <p>If the &lt;$input_filename_or_reference&gt; parameter is a simple scalar, it is assumed to be a filename. This file will be opened for reading and the input data will be read from it.</p> </dd> <dt id="A-filehandle"><a class="permalink" href="#A-filehandle">#</a><a id="A1"></a>A filehandle</dt> <dd> <p>If the <code>$input_filename_or_reference</code> parameter is a filehandle, the input data will be read from it. The string &#39;-&#39; can be used as an alias for standard input.</p> </dd> <dt id="A-scalar-reference"><a class="permalink" href="#A-scalar-reference">#</a><a id="A2"></a>A scalar reference</dt> <dd> <p>If <code>$input_filename_or_reference</code> is a scalar reference, the input data will be read from <code>$$input_filename_or_reference</code>.</p> </dd> <dt id="An-array-reference"><a class="permalink" href="#An-array-reference">#</a><a id="An"></a>An array reference</dt> <dd> <p>If <code>$input_filename_or_reference</code> is an array reference, each element in the array must be a filename.</p> <p>The input data will be read from each file in turn.</p> <p>The complete array will be walked to ensure that it only contains valid filenames before any data is uncompressed.</p> </dd> <dt id="An-Input-FileGlob-string"><a class="permalink" href="#An-Input-FileGlob-string">#</a><a id="An1"></a>An Input FileGlob string</dt> <dd> <p>If <code>$input_filename_or_reference</code> is a string that is delimited by the characters &quot;&lt;&quot; and &quot;&gt;&quot; <code>inflate</code> will assume that it is an <i>input fileglob string</i>. The input is the list of files that match the fileglob.</p> <p>See <a href="/5.18.4/File::GlobMapper">File::GlobMapper</a> for more details.</p> </dd> </dl> <p>If the <code>$input_filename_or_reference</code> parameter is any other type, <code>undef</code> will be returned.</p> <h3 id="The-$output_filename_or_reference-parameter"><a class="permalink" href="#The-$output_filename_or_reference-parameter">#</a><a id="The1"></a><a id="The-output_filename_or_reference-parameter"></a>The <code>$output_filename_or_reference</code> parameter</h3> <p>The parameter <code>$output_filename_or_reference</code> is used to control the destination of the uncompressed data. This parameter can take one of these forms.</p> <dl> <dt id="A-filename1"><a class="permalink" href="#A-filename1">#</a><a id="A3"></a>A filename</dt> <dd> <p>If the <code>$output_filename_or_reference</code> parameter is a simple scalar, it is assumed to be a filename. This file will be opened for writing and the uncompressed data will be written to it.</p> </dd> <dt id="A-filehandle1"><a class="permalink" href="#A-filehandle1">#</a><a id="A4"></a>A filehandle</dt> <dd> <p>If the <code>$output_filename_or_reference</code> parameter is a filehandle, the uncompressed data will be written to it. The string &#39;-&#39; can be used as an alias for standard output.</p> </dd> <dt id="A-scalar-reference1"><a class="permalink" href="#A-scalar-reference1">#</a><a id="A5"></a>A scalar reference</dt> <dd> <p>If <code>$output_filename_or_reference</code> is a scalar reference, the uncompressed data will be stored in <code>$$output_filename_or_reference</code>.</p> </dd> <dt id="An-Array-Reference"><a class="permalink" href="#An-Array-Reference">#</a><a id="An2"></a>An Array Reference</dt> <dd> <p>If <code>$output_filename_or_reference</code> is an array reference, the uncompressed data will be pushed onto the array.</p> </dd> <dt id="An-Output-FileGlob"><a class="permalink" href="#An-Output-FileGlob">#</a><a id="An3"></a>An Output FileGlob</dt> <dd> <p>If <code>$output_filename_or_reference</code> is a string that is delimited by the characters &quot;&lt;&quot; and &quot;&gt;&quot; <code>inflate</code> will assume that it is an <i>output fileglob string</i>. The output is the list of files that match the fileglob.</p> <p>When <code>$output_filename_or_reference</code> is an fileglob string, <code>$input_filename_or_reference</code> must also be a fileglob string. Anything else is an error.</p> <p>See <a href="/5.18.4/File::GlobMapper">File::GlobMapper</a> for more details.</p> </dd> </dl> <p>If the <code>$output_filename_or_reference</code> parameter is any other type, <code>undef</code> will be returned.</p> <h2 id="Notes"><a class="permalink" href="#Notes">#</a>Notes</h2> <p>When <code>$input_filename_or_reference</code> maps to multiple compressed files/buffers and <code>$output_filename_or_reference</code> is a single file/buffer, after uncompression <code>$output_filename_or_reference</code> will contain a concatenation of all the uncompressed data from each of the input files/buffers.</p> <h2 id="Optional-Parameters"><a class="permalink" href="#Optional-Parameters">#</a><a id="Optional"></a>Optional Parameters</h2> <p>Unless specified below, the optional parameters for <code>inflate</code>, <code>OPTS</code>, are the same as those used with the OO interface defined in the <a href="#Constructor-Options">&quot;Constructor Options&quot;</a> section below.</p> <dl> <dt id="AutoClose-=&gt;-0|1"><a class="permalink" href="#AutoClose-=%3E-0%7C1">#</a><a id="AutoClose"></a><a id="AutoClose-0-1"></a><code>AutoClose =&gt; 0|1</code></dt> <dd> <p>This option applies to any input or output data streams to <code>inflate</code> that are filehandles.</p> <p>If <code>AutoClose</code> is specified, and the value is true, it will result in all input and/or output filehandles being closed once <code>inflate</code> has completed.</p> <p>This parameter defaults to 0.</p> </dd> <dt id="BinModeOut-=&gt;-0|1"><a class="permalink" href="#BinModeOut-=%3E-0%7C1">#</a><a id="BinModeOut"></a><a id="BinModeOut-0-1"></a><code>BinModeOut =&gt; 0|1</code></dt> <dd> <p>When writing to a file or filehandle, set <code>binmode</code> before writing to the file.</p> <p>Defaults to 0.</p> </dd> <dt id="Append-=&gt;-0|1"><a class="permalink" href="#Append-=%3E-0%7C1">#</a><a id="Append"></a><a id="Append-0-1"></a><code>Append =&gt; 0|1</code></dt> <dd> <p>The behaviour of this option is dependent on the type of output data stream.</p> <ul> <li><p>A Buffer</p> <p>If <code>Append</code> is enabled, all uncompressed data will be append to the end of the output buffer. Otherwise the output buffer will be cleared before any uncompressed data is written to it.</p> </li> <li><p>A Filename</p> <p>If <code>Append</code> is enabled, the file will be opened in append mode. Otherwise the contents of the file, if any, will be truncated before any uncompressed data is written to it.</p> </li> <li><p>A Filehandle</p> <p>If <code>Append</code> is enabled, the filehandle will be positioned to the end of the file via a call to <code>seek</code> before any uncompressed data is written to it. Otherwise the file pointer will not be moved.</p> </li> </ul> <p>When <code>Append</code> is specified, and set to true, it will <i>append</i> all uncompressed data to the output data stream.</p> <p>So when the output is a filehandle it will carry out a seek to the eof before writing any uncompressed data. If the output is a filename, it will be opened for appending. If the output is a buffer, all uncompressed data will be appended to the existing buffer.</p> <p>Conversely when <code>Append</code> is not specified, or it is present and is set to false, it will operate as follows.</p> <p>When the output is a filename, it will truncate the contents of the file before writing any uncompressed data. If the output is a filehandle its position will not be changed. If the output is a buffer, it will be wiped before any uncompressed data is output.</p> <p>Defaults to 0.</p> </dd> <dt id="MultiStream-=&gt;-0|1"><a class="permalink" href="#MultiStream-=%3E-0%7C1">#</a><a id="MultiStream"></a><a id="MultiStream-0-1"></a><code>MultiStream =&gt; 0|1</code></dt> <dd> <p>If the input file/buffer contains multiple compressed data streams, this option will uncompress the whole lot as a single data stream.</p> <p>Defaults to 0.</p> </dd> <dt id="TrailingData-=&gt;-$scalar"><a class="permalink" href="#TrailingData-=%3E-$scalar">#</a><a id="TrailingData"></a><a id="TrailingData-scalar"></a><code>TrailingData =&gt; $scalar</code></dt> <dd> <p>Returns the data, if any, that is present immediately after the compressed data stream once uncompression is complete.</p> <p>This option can be used when there is useful information immediately following the compressed data stream, and you don&#39;t know the length of the compressed data stream.</p> <p>If the input is a buffer, <code>trailingData</code> will return everything from the end of the compressed data stream to the end of the buffer.</p> <p>If the input is a filehandle, <code>trailingData</code> will return the data that is left in the filehandle input buffer once the end of the compressed data stream has been reached. You can then use the filehandle to read the rest of the input file.</p> <p>Don&#39;t bother using <code>trailingData</code> if the input is a filename.</p> <p>If you know the length of the compressed data stream before you start uncompressing, you can avoid having to use <code>trailingData</code> by setting the <code>InputLength</code> option.</p> </dd> </dl> <h2 id="Examples"><a class="permalink" href="#Examples">#</a>Examples</h2> <p>To read the contents of the file <code>file1.txt.1950</code> and write the uncompressed data to the file <code>file1.txt</code>.</p> <pre><code>use strict ; use warnings ; use IO::Uncompress::Inflate qw(inflate $InflateError) ; my $input = &quot;file1.txt.1950&quot;; my $output = &quot;file1.txt&quot;; inflate $input =&gt; $output or die &quot;inflate failed: $InflateError\n&quot;;</code></pre> <p>To read from an existing Perl filehandle, <code>$input</code>, and write the uncompressed data to a buffer, <code>$buffer</code>.</p> <pre><code>use strict ; use warnings ; use IO::Uncompress::Inflate qw(inflate $InflateError) ; use IO::File ; my $input = new IO::File &quot;&lt;file1.txt.1950&quot; or die &quot;Cannot open &#39;file1.txt.1950&#39;: $!\n&quot; ; my $buffer ; inflate $input =&gt; \$buffer or die &quot;inflate failed: $InflateError\n&quot;;</code></pre> <p>To uncompress all files in the directory &quot;/my/home&quot; that match &quot;*.txt.1950&quot; and store the compressed data in the same directory</p> <pre><code>use strict ; use warnings ; use IO::Uncompress::Inflate qw(inflate $InflateError) ; inflate &#39;&lt;/my/home/*.txt.1950&gt;&#39; =&gt; &#39;&lt;/my/home/#1.txt&gt;&#39; or die &quot;inflate failed: $InflateError\n&quot;;</code></pre> <p>and if you want to compress each file one at a time, this will do the trick</p> <pre><code>use strict ; use warnings ; use IO::Uncompress::Inflate qw(inflate $InflateError) ; for my $input ( glob &quot;/my/home/*.txt.1950&quot; ) { my $output = $input; $output =~ s/.1950// ; inflate $input =&gt; $output or die &quot;Error compressing &#39;$input&#39;: $InflateError\n&quot;; }</code></pre> <h1 id="OO-Interface"><a class="permalink" href="#OO-Interface">#</a><a id="OO"></a>OO Interface</h1> <h2 id="Constructor"><a class="permalink" href="#Constructor">#</a>Constructor</h2> <p>The format of the constructor for IO::Uncompress::Inflate is shown below</p> <pre><code>my $z = new IO::Uncompress::Inflate $input [OPTS] or die &quot;IO::Uncompress::Inflate failed: $InflateError\n&quot;;</code></pre> <p>Returns an <code>IO::Uncompress::Inflate</code> object on success and undef on failure. The variable <code>$InflateError</code> will contain an error message on failure.</p> <p>If you are running Perl 5.005 or better the object, <code>$z</code>, returned from IO::Uncompress::Inflate can be used exactly like an <a href="/5.18.4/IO::File">IO::File</a> filehandle. This means that all normal input file operations can be carried out with <code>$z</code>. For example, to read a line from a compressed file/buffer you can use either of these forms</p> <pre><code>$line = $z-&gt;getline(); $line = &lt;$z&gt;;</code></pre> <p>The mandatory parameter <code>$input</code> is used to determine the source of the compressed data. This parameter can take one of three forms.</p> <dl> <dt id="A-filename2"><a class="permalink" href="#A-filename2">#</a><a id="A6"></a>A filename</dt> <dd> <p>If the <code>$input</code> parameter is a scalar, it is assumed to be a filename. This file will be opened for reading and the compressed data will be read from it.</p> </dd> <dt id="A-filehandle2"><a class="permalink" href="#A-filehandle2">#</a><a id="A7"></a>A filehandle</dt> <dd> <p>If the <code>$input</code> parameter is a filehandle, the compressed data will be read from it. The string &#39;-&#39; can be used as an alias for standard input.</p> </dd> <dt id="A-scalar-reference2"><a class="permalink" href="#A-scalar-reference2">#</a><a id="A8"></a>A scalar reference</dt> <dd> <p>If <code>$input</code> is a scalar reference, the compressed data will be read from <code>$$input</code>.</p> </dd> </dl> <h2 id="Constructor-Options"><a class="permalink" href="#Constructor-Options">#</a><a id="Constructor1"></a>Constructor Options</h2> <p>The option names defined below are case insensitive and can be optionally prefixed by a &#39;-&#39;. So all of the following are valid</p> <pre><code class="plaintext">-AutoClose -autoclose AUTOCLOSE autoclose</code></pre> <p>OPTS is a combination of the following options:</p> <dl> <dt id="AutoClose-=&gt;-0|11"><a class="permalink" href="#AutoClose-=%3E-0%7C11">#</a><a id="AutoClose1"></a><a id="AutoClose-0-11"></a><code>AutoClose =&gt; 0|1</code></dt> <dd> <p>This option is only valid when the <code>$input</code> parameter is a filehandle. If specified, and the value is true, it will result in the file being closed once either the <code>close</code> method is called or the IO::Uncompress::Inflate object is destroyed.</p> <p>This parameter defaults to 0.</p> </dd> <dt id="MultiStream-=&gt;-0|11"><a class="permalink" href="#MultiStream-=%3E-0%7C11">#</a><a id="MultiStream1"></a><a id="MultiStream-0-11"></a><code>MultiStream =&gt; 0|1</code></dt> <dd> <p>Allows multiple concatenated compressed streams to be treated as a single compressed stream. Decompression will stop once either the end of the file/buffer is reached, an error is encountered (premature eof, corrupt compressed data) or the end of a stream is not immediately followed by the start of another stream.</p> <p>This parameter defaults to 0.</p> </dd> <dt id="Prime-=&gt;-$string"><a class="permalink" href="#Prime-=%3E-$string">#</a><a id="Prime"></a><a id="Prime-string"></a><code>Prime =&gt; $string</code></dt> <dd> <p>This option will uncompress the contents of <code>$string</code> before processing the input file/buffer.</p> <p>This option can be useful when the compressed data is embedded in another file/data structure and it is not possible to work out where the compressed data begins without having to read the first few bytes. If this is the case, the uncompression can be <i>primed</i> with these bytes using this option.</p> </dd> <dt id="Transparent-=&gt;-0|1"><a class="permalink" href="#Transparent-=%3E-0%7C1">#</a><a id="Transparent"></a><a id="Transparent-0-1"></a><code>Transparent =&gt; 0|1</code></dt> <dd> <p>If this option is set and the input file/buffer is not compressed data, the module will allow reading of it anyway.</p> <p>In addition, if the input file/buffer does contain compressed data and there is non-compressed data immediately following it, setting this option will make this module treat the whole file/buffer as a single data stream.</p> <p>This option defaults to 1.</p> </dd> <dt id="BlockSize-=&gt;-$num"><a class="permalink" href="#BlockSize-=%3E-$num">#</a><a id="BlockSize"></a><a id="BlockSize-num"></a><code>BlockSize =&gt; $num</code></dt> <dd> <p>When reading the compressed input data, IO::Uncompress::Inflate will read it in blocks of <code>$num</code> bytes.</p> <p>This option defaults to 4096.</p> </dd> <dt id="InputLength-=&gt;-$size"><a class="permalink" href="#InputLength-=%3E-$size">#</a><a id="InputLength"></a><a id="InputLength-size"></a><code>InputLength =&gt; $size</code></dt> <dd> <p>When present this option will limit the number of compressed bytes read from the input file/buffer to <code>$size</code>. This option can be used in the situation where there is useful data directly after the compressed data stream and you know beforehand the exact length of the compressed data stream.</p> <p>This option is mostly used when reading from a filehandle, in which case the file pointer will be left pointing to the first byte directly after the compressed data stream.</p> <p>This option defaults to off.</p> </dd> <dt id="Append-=&gt;-0|11"><a class="permalink" href="#Append-=%3E-0%7C11">#</a><a id="Append1"></a><a id="Append-0-11"></a><code>Append =&gt; 0|1</code></dt> <dd> <p>This option controls what the <code>read</code> method does with uncompressed data.</p> <p>If set to 1, all uncompressed data will be appended to the output parameter of the <code>read</code> method.</p> <p>If set to 0, the contents of the output parameter of the <code>read</code> method will be overwritten by the uncompressed data.</p> <p>Defaults to 0.</p> </dd> <dt id="Strict-=&gt;-0|1"><a class="permalink" href="#Strict-=%3E-0%7C1">#</a><a id="Strict"></a><a id="Strict-0-1"></a><code>Strict =&gt; 0|1</code></dt> <dd> <p>This option controls whether the extra checks defined below are used when carrying out the decompression. When Strict is on, the extra tests are carried out, when Strict is off they are not.</p> <p>The default for this option is off.</p> <ol> <li><p>The ADLER32 checksum field must be present.</p> </li> <li><p>The value of the ADLER32 field read must match the adler32 value of the uncompressed data actually contained in the file.</p> </li> </ol> </dd> </dl> <h2 id="Examples1"><a class="permalink" href="#Examples1">#</a>Examples</h2> <p>TODO</p> <h1 id="Methods"><a class="permalink" href="#Methods">#</a>Methods</h1> <h2 id="read"><a class="permalink" href="#read">#</a>read</h2> <p>Usage is</p> <pre><code>$status = $z-&gt;read($buffer)</code></pre> <p>Reads a block of compressed data (the size the the compressed block is determined by the <code>Buffer</code> option in the constructor), uncompresses it and writes any uncompressed data into <code>$buffer</code>. If the <code>Append</code> parameter is set in the constructor, the uncompressed data will be appended to the <code>$buffer</code> parameter. Otherwise <code>$buffer</code> will be overwritten.</p> <p>Returns the number of uncompressed bytes written to <code>$buffer</code>, zero if eof or a negative number on error.</p> <h2 id="read1"><a class="permalink" href="#read1">#</a>read</h2> <p>Usage is</p> <pre><code>$status = $z-&gt;read($buffer, $length) $status = $z-&gt;read($buffer, $length, $offset) $status = read($z, $buffer, $length) $status = read($z, $buffer, $length, $offset)</code></pre> <p>Attempt to read <code>$length</code> bytes of uncompressed data into <code>$buffer</code>.</p> <p>The main difference between this form of the <code>read</code> method and the previous one, is that this one will attempt to return <i>exactly</i> <code>$length</code> bytes. The only circumstances that this function will not is if end-of-file or an IO error is encountered.</p> <p>Returns the number of uncompressed bytes written to <code>$buffer</code>, zero if eof or a negative number on error.</p> <h2 id="getline"><a class="permalink" href="#getline">#</a>getline</h2> <p>Usage is</p> <pre><code>$line = $z-&gt;getline() $line = &lt;$z&gt;</code></pre> <p>Reads a single line.</p> <p>This method fully supports the use of of the variable <code>$/</code> (or <code>$INPUT_RECORD_SEPARATOR</code> or <code>$RS</code> when <code>English</code> is in use) to determine what constitutes an end of line. Paragraph mode, record mode and file slurp mode are all supported.</p> <h2 id="getc"><a class="permalink" href="#getc">#</a>getc</h2> <p>Usage is</p> <pre><code>$char = $z-&gt;getc()</code></pre> <p>Read a single character.</p> <h2 id="ungetc"><a class="permalink" href="#ungetc">#</a>ungetc</h2> <p>Usage is</p> <pre><code>$char = $z-&gt;ungetc($string)</code></pre> <h2 id="inflateSync"><a class="permalink" href="#inflateSync">#</a>inflateSync</h2> <p>Usage is</p> <pre><code>$status = $z-&gt;inflateSync()</code></pre> <p>TODO</p> <h2 id="getHeaderInfo"><a class="permalink" href="#getHeaderInfo">#</a>getHeaderInfo</h2> <p>Usage is</p> <pre><code>$hdr = $z-&gt;getHeaderInfo(); @hdrs = $z-&gt;getHeaderInfo();</code></pre> <p>This method returns either a hash reference (in scalar context) or a list or hash references (in array context) that contains information about each of the header fields in the compressed data stream(s).</p> <h2 id="tell"><a class="permalink" href="#tell">#</a>tell</h2> <p>Usage is</p> <pre><code>$z-&gt;tell() tell $z</code></pre> <p>Returns the uncompressed file offset.</p> <h2 id="eof"><a class="permalink" href="#eof">#</a>eof</h2> <p>Usage is</p> <pre><code>$z-&gt;eof(); eof($z);</code></pre> <p>Returns true if the end of the compressed input stream has been reached.</p> <h2 id="seek"><a class="permalink" href="#seek">#</a>seek</h2> <pre><code>$z-&gt;seek($position, $whence); seek($z, $position, $whence);</code></pre> <p>Provides a sub-set of the <code>seek</code> functionality, with the restriction that it is only legal to seek forward in the input file/buffer. It is a fatal error to attempt to seek backward.</p> <p>Note that the implementation of <code>seek</code> in this module does not provide true random access to a compressed file/buffer. It works by uncompressing data from the current offset in the file/buffer until it reaches the ucompressed offset specified in the parameters to <code>seek</code>. For very small files this may be acceptable behaviour. For large files it may cause an unacceptable delay.</p> <p>The <code>$whence</code> parameter takes one the usual values, namely SEEK_SET, SEEK_CUR or SEEK_END.</p> <p>Returns 1 on success, 0 on failure.</p> <h2 id="binmode"><a class="permalink" href="#binmode">#</a>binmode</h2> <p>Usage is</p> <pre><code>$z-&gt;binmode binmode $z ;</code></pre> <p>This is a noop provided for completeness.</p> <h2 id="opened"><a class="permalink" href="#opened">#</a>opened</h2> <pre><code>$z-&gt;opened()</code></pre> <p>Returns true if the object currently refers to a opened file/buffer.</p> <h2 id="autoflush"><a class="permalink" href="#autoflush">#</a>autoflush</h2> <pre><code>my $prev = $z-&gt;autoflush() my $prev = $z-&gt;autoflush(EXPR)</code></pre> <p>If the <code>$z</code> object is associated with a file or a filehandle, this method returns the current autoflush setting for the underlying filehandle. If <code>EXPR</code> is present, and is non-zero, it will enable flushing after every write/print operation.</p> <p>If <code>$z</code> is associated with a buffer, this method has no effect and always returns <code>undef</code>.</p> <p><b>Note</b> that the special variable <code>$|</code> <b>cannot</b> be used to set or retrieve the autoflush setting.</p> <h2 id="input_line_number"><a class="permalink" href="#input_line_number">#</a>input_line_number</h2> <pre><code>$z-&gt;input_line_number() $z-&gt;input_line_number(EXPR)</code></pre> <p>Returns the current uncompressed line number. If <code>EXPR</code> is present it has the effect of setting the line number. Note that setting the line number does not change the current position within the file/buffer being read.</p> <p>The contents of <code>$/</code> are used to to determine what constitutes a line terminator.</p> <h2 id="fileno"><a class="permalink" href="#fileno">#</a>fileno</h2> <pre><code>$z-&gt;fileno() fileno($z)</code></pre> <p>If the <code>$z</code> object is associated with a file or a filehandle, <code>fileno</code> will return the underlying file descriptor. Once the <code>close</code> method is called <code>fileno</code> will return <code>undef</code>.</p> <p>If the <code>$z</code> object is associated with a buffer, this method will return <code>undef</code>.</p> <h2 id="close"><a class="permalink" href="#close">#</a>close</h2> <pre><code>$z-&gt;close() ; close $z ;</code></pre> <p>Closes the output file/buffer.</p> <p>For most versions of Perl this method will be automatically invoked if the IO::Uncompress::Inflate object is destroyed (either explicitly or by the variable with the reference to the object going out of scope). The exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In these cases, the <code>close</code> method will be called automatically, but not until global destruction of all live objects when the program is terminating.</p> <p>Therefore, if you want your scripts to be able to run on all versions of Perl, you should call <code>close</code> explicitly and not rely on automatic closing.</p> <p>Returns true on success, otherwise 0.</p> <p>If the <code>AutoClose</code> option has been enabled when the IO::Uncompress::Inflate object was created, and the object is associated with a file, the underlying file will also be closed.</p> <h2 id="nextStream"><a class="permalink" href="#nextStream">#</a>nextStream</h2> <p>Usage is</p> <pre><code>my $status = $z-&gt;nextStream();</code></pre> <p>Skips to the next compressed data stream in the input file/buffer. If a new compressed data stream is found, the eof marker will be cleared and <code>$.</code> will be reset to 0.</p> <p>Returns 1 if a new stream was found, 0 if none was found, and -1 if an error was encountered.</p> <h2 id="trailingData"><a class="permalink" href="#trailingData">#</a>trailingData</h2> <p>Usage is</p> <pre><code>my $data = $z-&gt;trailingData();</code></pre> <p>Returns the data, if any, that is present immediately after the compressed data stream once uncompression is complete. It only makes sense to call this method once the end of the compressed data stream has been encountered.</p> <p>This option can be used when there is useful information immediately following the compressed data stream, and you don&#39;t know the length of the compressed data stream.</p> <p>If the input is a buffer, <code>trailingData</code> will return everything from the end of the compressed data stream to the end of the buffer.</p> <p>If the input is a filehandle, <code>trailingData</code> will return the data that is left in the filehandle input buffer once the end of the compressed data stream has been reached. You can then use the filehandle to read the rest of the input file.</p> <p>Don&#39;t bother using <code>trailingData</code> if the input is a filename.</p> <p>If you know the length of the compressed data stream before you start uncompressing, you can avoid having to use <code>trailingData</code> by setting the <code>InputLength</code> option in the constructor.</p> <h1 id="Importing"><a class="permalink" href="#Importing">#</a>Importing</h1> <p>No symbolic constants are required by this IO::Uncompress::Inflate at present.</p> <dl> <dt id=":all"><a class="permalink" href="#:all">#</a><a id="all"></a>:all</dt> <dd> <p>Imports <code>inflate</code> and <code>$InflateError</code>. Same as doing this</p> <pre><code>use IO::Uncompress::Inflate qw(inflate $InflateError) ;</code></pre> </dd> </dl> <h1 id="EXAMPLES"><a class="permalink" href="#EXAMPLES">#</a>EXAMPLES</h1> <h2 id="Working-with-Net::FTP"><a class="permalink" href="#Working-with-Net::FTP">#</a><a id="Working"></a>Working with Net::FTP</h2> <p>See <a href="/5.18.4/IO::Compress::FAQ#Compressed-files-and-Net%3A%3AFTP">IO::Compress::FAQ</a></p> <h1 id="SEE-ALSO"><a class="permalink" href="#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1> <p><a href="/5.18.4/Compress::Zlib">Compress::Zlib</a>, <a href="/5.18.4/IO::Compress::Gzip">IO::Compress::Gzip</a>, <a href="/5.18.4/IO::Uncompress::Gunzip">IO::Uncompress::Gunzip</a>, <a href="/5.18.4/IO::Compress::Deflate">IO::Compress::Deflate</a>, <a href="/5.18.4/IO::Compress::RawDeflate">IO::Compress::RawDeflate</a>, <a href="/5.18.4/IO::Uncompress::RawInflate">IO::Uncompress::RawInflate</a>, <a href="/5.18.4/IO::Compress::Bzip2">IO::Compress::Bzip2</a>, <a href="/5.18.4/IO::Uncompress::Bunzip2">IO::Uncompress::Bunzip2</a>, <a href="/5.18.4/IO::Compress::Lzma">IO::Compress::Lzma</a>, <a href="/5.18.4/IO::Uncompress::UnLzma">IO::Uncompress::UnLzma</a>, <a href="/5.18.4/IO::Compress::Xz">IO::Compress::Xz</a>, <a href="/5.18.4/IO::Uncompress::UnXz">IO::Uncompress::UnXz</a>, <a href="/5.18.4/IO::Compress::Lzop">IO::Compress::Lzop</a>, <a href="/5.18.4/IO::Uncompress::UnLzop">IO::Uncompress::UnLzop</a>, <a href="/5.18.4/IO::Compress::Lzf">IO::Compress::Lzf</a>, <a href="/5.18.4/IO::Uncompress::UnLzf">IO::Uncompress::UnLzf</a>, <a href="/5.18.4/IO::Uncompress::AnyInflate">IO::Uncompress::AnyInflate</a>, <a href="/5.18.4/IO::Uncompress::AnyUncompress">IO::Uncompress::AnyUncompress</a></p> <p><a href="/5.18.4/IO::Compress::FAQ">IO::Compress::FAQ</a></p> <p><a href="/5.18.4/File::GlobMapper">File::GlobMapper</a>, <a href="/5.18.4/Archive::Zip">Archive::Zip</a>, <a href="/5.18.4/Archive::Tar">Archive::Tar</a>, <a href="/5.18.4/IO::Zlib">IO::Zlib</a></p> <p>For RFC 1950, 1951 and 1952 see <i>http://www.faqs.org/rfcs/rfc1950.html</i>, <i>http://www.faqs.org/rfcs/rfc1951.html</i> and <i>http://www.faqs.org/rfcs/rfc1952.html</i></p> <p>The <i>zlib</i> compression library was written by Jean-loup Gailly <i>gzip@prep.ai.mit.edu</i> and Mark Adler <i>madler@alumni.caltech.edu</i>.</p> <p>The primary site for the <i>zlib</i> compression library is <i>http://www.zlib.org</i>.</p> <p>The primary site for gzip is <i>http://www.gzip.org</i>.</p> <h1 id="AUTHOR"><a class="permalink" href="#AUTHOR">#</a>AUTHOR</h1> <p>This module was written by Paul Marquess, <i>pmqs@cpan.org</i>.</p> <h1 id="MODIFICATION-HISTORY"><a class="permalink" href="#MODIFICATION-HISTORY">#</a><a id="MODIFICATION"></a>MODIFICATION HISTORY</h1> <p>See the Changes file.</p> <h1 id="COPYRIGHT-AND-LICENSE"><a class="permalink" href="#COPYRIGHT-AND-LICENSE">#</a><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1> <p>Copyright (c) 2005-2013 Paul Marquess. All rights reserved.</p> <p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/js/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10