develooper Front page | perl.bootstrap | Postings from July 2000

Re: perl 6 requirements

Thread Previous | Thread Next
Edwin Wiles
July 31, 2000 12:30
Re: perl 6 requirements
Message ID:

Buddha Buck wrote:
> The pack/unpack has to happen at sometime.  Perhaps what would work would
> be to create a module or core type that would remember its pack
> format.  Ideally, when used in a scalar context, it would look like its
> packed representation; when in a hash context, like its unpacked
> representation.  Something like:
> # game message data consists of objectID; position x,y,z; orientation
> # ux,uy,uz (up direction) and nx,ny,nz (nose direction), velocity
> # vx,vy,vz, and acceleration ax,ay,az all as 32-bit integers in network
> # byte order (packet size: 512B).  Object ID of 0 means update complete.
> #
> # $packet pre-defined to have a pack format of "NNNNNNNNNNNNNNNN"
> {
>    sysread SERVER, $packet, 512;
>    last if $packet{'objectID'} == 0;
>    $remoteobject[$packet{'objectID'}] = { %packet };
> }
> Is that sort of what you'd like?

Would this be any better than writing up your own little perl module to
handle the task using the existing unpack/pack commands?

Or could we make this a generalized perl module, with format definitions
tied to variable names.... Hmmm... I think I'll give this a bit more of
a look.  It could be very useful to me, maybe useful for perl 6, and
certainly useful for perl 5.

For perl 5, it would certainly be a normal 'module', but for perl 6, it
might be part of the basic distribution.

I'll check the existing packages first... no need for another square


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About