From: "Soren Andersen" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] CC: "Matt Seddon" <[EMAIL PROTECTED]> Subject: Re: Binary File Modules Date: Sun, 22 Jun 2003 15:05:42 -0400
On 19 Jun 2003 05:55:37 -0000, Matt Seddon posted about a module he's been working on:
> Hello all. Recently, I needed to extract version information from windows
> .exe and .dll files, which spurred me to create a new module that sneaks
> into a Portable Executable and pull out all sorts of info:
> use FileFormat::PE;
{snip}
Sounds like a great idea!
However, I will make a namespace observation. I see no FileFormat:: tld
on
search.cpan.org. If there isn't one then you're going to get stiff resistance
(so I hear) to creating a new one for this package. Might I humbly suggest
based on a little thinking over what i am seeing on CPAN, that Parse:: might
be the right tld for your modules?
aha! Parse:: may well be an appropriate namespace- it's certainly got this kind of functionality for (admittedly more ascii) file types (e.g. logs).
> It is pure perl, is tested, and runs happily under linux, OS-X and Win32.
Excellent.
Hey, I can't sleep if I've not tested it everywhere :)
[...] "PE" is IMHO enough to effectively convey what this module
is for. Those who might want to get such info out of Win32 executable
image files will already know what "PE" is. As soon as i saw "PE" in your message I
felt that I knew just what it was about.
So I might suggest:
Parse::FileFormat::[PE,ELF,etc.]
or maybe:
Parse::BinImage::[...]
or even:
Parse::ExeImage::[...]
or even:
Parse::(Bin)?ImageInfo::[...]
or finally:
Parse::(Bin)?ImageMeta::[...]
(since the kind of info you are talking about is "meta info" for a particular binary executable image). Parse::FileMetaInfo perhaps?
whew ;) Well, Parse::FileFormat seems to be a good place to start, I suspect. Maybe I could lay out a Parse::FileFormat::PE for full PE access, and a class like the unix command 'file', Parse::FileFormat::MetaInfo, which returns some simple summary information about the file type.
The other namespace I am considering is File::Details, but I feel the intention is not so clear.
> Does anyone else actually even have a use for this package? :)
Yes, I am pretty sure I will find it useful!
=)
So, for those interested, my framework is probably going to sit like this:
Parse::FileFormat and Parse::FileFormat::<your-filetype-here>
There will be sub-classes available for other kinds of files, "Parse::FileFormat::Image", "Parse::FileFormat::BinaryObject" etc. will provide abstract classes to obtain and possibly manipulate properties that are salient among file formats of that type. (PE files, ELF files, and Darwin dynlib's all have exported symbol table lists, and image files have at least width/height/bpp information.)
Ideally, I would like to be able to have a method "filetype" or simliar in FileFormat be able to detect an extensible set of file formats, so people can extend the descriptions easily whilst still keeping the library small and modular, though short of having some dirty push statement in a module's BEGIN... and ensuring you use each module containing the appropriate file type, I can't think of a simple way to do this. *tmtowtdi*, so if you have any ideas, I'd love to know :)
Thanks again for all the support and interest guys :) Matt.
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends http://www.msn.co.uk/messenger
