On 21/11/2013 1:04 PM, neil.lunn wrote:
On 21/11/2013 11:48 AM, Bill Moseley wrote:

$ perl -MIO::Uncompress::Gunzip -le 'use Data::Dumper; print Dumper +IO::Uncompress::Gunzip->new( "Catalyst-Runtime-5.90051.tar.gz" )->getHeaderInfo'
Oh, and a test case outside of catalyst, noting the -s operator fail:


echo "1234567890ABCDEFG" | gzip -c >x.gz

#!/usr/bin/env perl
use Modern::Perl;

use File::Slurp;
use IO::Uncompress::Gunzip;
use Data::Dumper;

my $z = read_file "x.gz";
my $fh = IO::Uncompress::Gunzip->new( \$z );

my $size = -s $fh;

print Dumper( $fh->getHeaderInfo );
print "Size: ", $fh->getHeaderInfo->{ISIZE}, "\n";
print $fh->getline();
$fh->close();

-s on unopened filehandle GEN0 at test.pl line 11.
$VAR1 = {
          'NameFlag' => 0,
          'TrailerLength' => 8,
          'Header' => '??R',
          'CRC32' => 3714309751,
          'ISIZE' => 18,
          'ExtraFlag' => 0,
          'Flags' => 0,
          'Comment' => undef,
          'isMinimalHeader' => 0,
          'ExtraField' => [],
          'HeaderLength' => 10,
          'OsID' => 3,
          'MethodID' => 8,
          'MethodName' => 'Deflated',
          'HeaderCRC' => undef,
          'TextFlag' => 0,
          'Name' => undef,
          'CommentFlag' => 0,
          'HeaderCRCFlag' => 0,
          'Type' => 'rfc1952',
          'FingerprintLength' => 2,
          'Time' => 1384950479,
          'ExtraFlags' => 0,
          'ExtraFieldRaw' => undef,
          'OsName' => 'Unix'
        };
Size: 18
1234567890ABCDEFG

$VAR1 = {
          'Time' => 1383843952,
          'Flags' => 8,
          'TextFlag' => 0,
          'MethodID' => 8,
          'ExtraField' => [],
          'CommentFlag' => 0,
          'Type' => 'rfc1952',
          'NameFlag' => 1,
          'ExtraFlags' => 2,
          'HeaderCRC' => undef,
          'isMinimalHeader' => 0,
          'MethodName' => 'Deflated',
          'ExtraFlag' => 0,
          'HeaderLength' => 39,
          'ExtraFieldRaw' => undef,
          'Comment' => undef,
          'OsName' => 'Unix',
          'FingerprintLength' => 2,
          'HeaderCRCFlag' => 0,
          'OsID' => 3,
          'TrailerLength' => 8,
          'Name' => 'Catalyst-Runtime-5.90051.tar',
          'Header' => p?{RCatalyst-Runtime-5.90051.tar'
        };


--
Bill Moseley
[email protected] <mailto:[email protected]>


_______________________________________________
List:[email protected]
Listinfo:http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive:http://www.mail-archive.com/[email protected]/
Dev site:http://dev.catalyst.perl.org/



------------------------------------------------------------------------
<http://www.avast.com/>   

This email is free from viruses and malware because avast! Antivirus <http://www.avast.com/> protection is active.




_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to