Parse::Binary::FixedFormat 0.10 review

Download
by rbytes.net on

Parse::Binary::FixedFormat is a Perl module to convert between fixed-length fields and hashes. SYNOPSIS use Parse::Binary::F

License: Perl Artistic License
File size: 31K
Developer: Autrijus Tang
0 stars award from rbytes.net

Parse::Binary::FixedFormat is a Perl module to convert between fixed-length fields and hashes.

SYNOPSIS

use Parse::Binary::FixedFormat;

my $tarhdr =
new Parse::Binary::FixedFormat [ qw(name:a100 mode:a8 uid:a8 gid:a8 size:a12
mtime:a12 chksum:a8 typeflag:a1 linkname:a100
magic:a6 version:a2 uname:a32 gname:a32
devmajor:a8 devminor:a8 prefix:a155) ];
my $buf;
read TARFILE, $buf, 512;

# create a hash from the buffer read from the file
my $hdr = $tarhdr->unformat($buf); # $hdr gets a hash ref

# create a flat record from a hash reference
my $buf = $tarhdr->format($hdr); # $hdr is a hash ref

# create a hash for a new record
my $newrec = $tarhdr->blank();

Parse::Binary::FixedFormat can be used to convert between a buffer with fixed-length field definitions and a hash with named entries for each field. The perl pack and unpack functions are used to perform the conversions. Parse::Binary::FixedFormat builds the format string by concatenating the field descriptions and converts between the lists used by pack and unpack and a hash that can be reference by field name.

Requirements:
Perl

Parse::Binary::FixedFormat 0.10 keywords