use bytes;
-use IO::Compress::RawDeflate 2.008 ;
+use IO::Compress::RawDeflate 2.009 ;
-use Compress::Raw::Zlib 2.008 ;
-use IO::Compress::Base::Common 2.008 qw(:Status :Parse createSelfTiedObject);
-use IO::Compress::Gzip::Constants 2.008 ;
-use IO::Compress::Zlib::Extra 2.008 ;
+use Compress::Raw::Zlib 2.009 ;
+use IO::Compress::Base::Common 2.009 qw(:Status :Parse createSelfTiedObject);
+use IO::Compress::Gzip::Constants 2.009 ;
+use IO::Compress::Zlib::Extra 2.009 ;
BEGIN
{
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $GzipError);
-$VERSION = '2.008';
+$VERSION = '2.009';
$GzipError = '' ;
@ISA = qw(Exporter IO::Compress::RawDeflate);
=head1 NAME
-
-
IO::Compress::Gzip - Write RFC 1952 files/buffers
use IO::Compress::Gzip qw(gzip $GzipError) ;
-
my $status = gzip $input => $output [,OPTS]
or die "gzip failed: $GzipError\n";
=head1 DESCRIPTION
-
This module provides a Perl interface that allows writing compressed
data to files or buffer as defined in RFC 1952.
-
-
-
-
All the gzip headers defined in RFC 1952 can be created using
this module.
-
-
-
-
-
-
For reading RFC 1952 files/buffers, see the companion module
L<IO::Uncompress::Gunzip|IO::Uncompress::Gunzip>.
-
=head1 Functional Interface
A top-level function, C<gzip>, is provided to carry out
gzip $input => $output [,OPTS]
or die "gzip failed: $GzipError\n";
-
-
The functional interface needs Perl5.005 or better.
-
=head2 gzip $input => $output [, OPTS]
-
C<gzip> expects at least two parameters, C<$input> and C<$output>.
=head3 The C<$input> parameter
The complete array will be walked to ensure that it only
contains valid filenames before any data is compressed.
-
-
=item An Input FileGlob string
If C<$input> is a string that is delimited by the characters "<" and ">"
See L<File::GlobMapper|File::GlobMapper> for more details.
-
=back
If the C<$input> parameter is any other type, C<undef> will be returned.
-
In addition, if C<$input> is a simple filename, the default values for
the C<Name> and C<Time> options will be sourced from that file.
explicitly setting the C<Name> and C<Time> options or by setting the
C<Minimal> parameter.
-
-
=head3 The C<$output> parameter
The parameter C<$output> is used to control the destination of the
will be written to it.
The string '-' can be used as an alias for standard output.
-
=item A scalar reference
If C<$output> is a scalar reference, the compressed data will be
stored in C<$$output>.
-
-
=item An Array Reference
If C<$output> is an array reference, the compressed data will be
If the C<$output> parameter is any other type, C<undef> will be returned.
-
-
=head2 Notes
-
-
When C<$input> maps to multiple files/buffers and C<$output> is a single
file/buffer the input files/buffers will be stored
in C<$output> as a concatenated series of compressed data streams.
-
-
-
-
-
=head2 Optional Parameters
Unless specified below, the optional parameters for C<gzip>,
This parameter defaults to 0.
-
=item C<< BinModeIn => 0|1 >>
When reading from a file or filehandle, set C<binmode> before reading.
Defaults to 0.
-
-
-
-
=item C<< Append => 0|1 >>
TODO
-
-
=back
-
-
=head2 Examples
To read the contents of the file C<file1.txt> and write the compressed
gzip $input => "$input.gz"
or die "gzip failed: $GzipError\n";
-
To read from an existing Perl filehandle, C<$input>, and write the
compressed data to a buffer, C<$buffer>.
or die "Error compressing '$input': $GzipError\n";
}
-
=head1 OO Interface
=head2 Constructor
written to it.
The string '-' can be used as an alias for standard output.
-
=item A scalar reference
If C<$output> is a scalar reference, the compressed data will be stored
This parameter defaults to 0.
-
-
-
-
=item C<< Merge => 0|1 >>
This option is used to compress input data and append it to an existing
compressed data stream in C<$output>. The end result is a single compressed
data stream stored in C<$output>.
-
-
It is a fatal error to attempt to use this option when C<$output> is not an
RFC 1952 data stream.
-
-
There are a number of other limitations with the C<Merge> option:
=over 5
=back
-
This parameter defaults to 0.
-
-
=item -Level
Defines the compression level used by zlib. The value should either be
The default is Z_DEFAULT_STRATEGY.
-
-
-
-
-
=item C<< Minimal => 0|1 >>
If specified, this option will force the creation of the smallest possible
If C<< Level => Z_BEST_COMPRESSION >> has been specified then XFL is set to 4.
Otherwise XFL is set to 0.
-
-
=item C<< Strict => 0|1 >>
-
-
C<Strict> will optionally police the values supplied with other options
to ensure they are compliant with RFC1952.
=back
-
-
=back
=head2 Examples
Usage is
-
$z->flush;
$z->flush($flush_type);
-
Flushes any pending compressed data to the output file/buffer.
-
This method takes an optional parameter, C<$flush_type>, that controls
how the flushing will be carried out. By default the C<$flush_type>
used is C<Z_FINISH>. Other valid values for C<$flush_type> are
can seriously degrade the level of compression achieved. See the C<zlib>
documentation for details.
-
Returns true on success.
-
=head2 tell
Usage is
$z->eof();
eof($z);
-
-
Returns true if the C<close> method has been called.
-
-
=head2 seek
$z->seek($position, $whence);
seek($z, $position, $whence);
-
-
-
Provides a sub-set of the C<seek> functionality, with the restriction
that it is only legal to seek forward in the output file/buffer.
It is a fatal error to attempt to seek backward.
Empty parts of the file/buffer will have NULL (0x00) bytes written to them.
-
-
The C<$whence> parameter takes one the usual values, namely SEEK_SET,
SEEK_CUR or SEEK_END.
$z->input_line_number()
$z->input_line_number(EXPR)
-
This method always returns C<undef> when compressing.
-
-
=head2 fileno
$z->fileno()
fileno($z)
-If the C<$z> object is associated with a file or a filehandle, this method
-will return the underlying file descriptor.
+If the C<$z> object is associated with a file or a filehandle, C<fileno>
+will return the underlying file descriptor. Once the C<close> method is
+called C<fileno> will return C<undef>.
-If the C<$z> object is is associated with a buffer, this method will
-return undef.
+If the C<$z> object is is associated with a buffer, this method will return
+C<undef>.
=head2 close
$z->close() ;
close $z ;
-
-
Flushes any pending compressed data and then closes the output file/buffer.
-
-
For most versions of Perl this method will be automatically invoked if
the IO::Compress::Gzip object is destroyed (either explicitly or by the
variable with the reference to the object going out of scope). The
object was created, and the object is associated with a file, the
underlying file will also be closed.
-
-
-
=head2 newStream([OPTS])
Usage is
See the L</"Constructor Options"> section for more details.
-
=head2 deflateParams
Usage is
TODO
-
=head1 Importing
-
A number of symbolic constants are required by some methods in
C<IO::Compress::Gzip>. None are imported by default.
-
-
=over 5
=item :all
-
Imports C<gzip>, C<$GzipError> and all symbolic
constants that can be used by C<IO::Compress::Gzip>. Same as doing this
Import all symbolic constants. Same as doing this
-
use IO::Compress::Gzip qw(:flush :level :strategy) ;
-
=item :flush
These symbolic constants are used by the C<flush> method.
Z_BEST_COMPRESSION
Z_DEFAULT_COMPRESSION
-
=item :strategy
These symbolic constants are used by the C<Strategy> option in the constructor.
=back
-For
-
=head1 EXAMPLES
-TODO
-
-
-
-
-
-
+=head2 Apache::GZip Revisited
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Apache::GZip Revisited">
+
+=head2 Working with Net::FTP
+See L<IO::Compress::Zlib::FAQ|IO::Compress::Zlib::FAQ/"Compressed files and Net::FTP">
=head1 SEE ALSO
L<Archive::Tar|Archive::Tar>,
L<IO::Zlib|IO::Zlib>
-
For RFC 1950, 1951 and 1952 see
F<http://www.faqs.org/rfcs/rfc1950.html>,
F<http://www.faqs.org/rfcs/rfc1951.html> and
The primary site for gzip is F<http://www.gzip.org>.
-
-
-
=head1 AUTHOR
This module was written by Paul Marquess, F<pmqs@cpan.org>.
-
-
=head1 MODIFICATION HISTORY
See the Changes file.
=head1 COPYRIGHT AND LICENSE
-Copyright (c) 2005-2007 Paul Marquess. All rights reserved.
+Copyright (c) 2005-2008 Paul Marquess. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
-