develooper Front page | perl.perl6.language | Postings from September 2000

pack/unpack is damn unperlish. Explain them as Perl.

Thread Next
From:
Michael G Schwern
Date:
September 17, 2000 23:53
Subject:
pack/unpack is damn unperlish. Explain them as Perl.
Message ID:
20000918025332.D15142@athens.aocn.com
My first language was Perl and its pretty much my native computing
tongue.  My lack of a firm grounding in C or other lower level
language probably hamstrings my understanding of manipulating binary
structures (I do, at least, understand what "single-precision float in
the native format" means, but it makes my feet itch).  This is
probably a Good Thing in this case, as I'm scratching my head, along
with lots of other people, over what the hell pack is good for and how
do you use it?

Its just damn unperlish.  Perhaps that's in its nature, being that its
for converting data from things which are Perl, but we've got to be
able to do better.

I really can't articulate better than that because I don't really grok
the existing pack/unpack and what they're supposed to do.  Something
about converting binary structures into Perl and vice-versa.  But
there's got to be a better way.  Maybe the docs just need an overhaul.

Perhaps someone could attempt to write an explaination of pack and
unpack in completely Perl terms.  No bits, no ints, no nybbles, no
IEEE floating point arithmetic, no prior knowledge of C necessary.
Those are not Perl.  Scalars, arrays, hashes, functions, methods,
loops, contexts.  These are Perl.

This is *explaination*, not documentation.  I don't want details, I
want to know the basics of who needs it, what it does, when I should
use it and how its used.

Once we have this in hand, it may help us to write a better interface.
If nothing else, we'll get a perlpacktut man page.

-- 

Michael G Schwern      http://www.pobox.com/~schwern/      schwern@pobox.com
Just Another Stupid Consultant                      Perl6 Kwalitee Ashuranse
If you only hear one song this year there's something terribly wrong
with you.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About