Skip Menu |

This queue is for tickets about the File-LibMagic CPAN distribution.

Report information
The Basics
Id: 99470
Status: resolved
Priority: 0/
Queue: File-LibMagic

People
Owner: Nobody in particular
Requestors: niels [...] thykier.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [File::LibMagic] Please expose more of libmagic's API with :complete
Date: Tue, 14 Oct 2014 00:29:35 +0200
To: bug-file-libmagic [...] rt.cpan.org
From: Niels Thykier <niels [...] thykier.net>
Hi, Thanks for making File::LibMagic. I would like to have more of File::LibMagic's API exposed, e.g. via the ":complete" import tag. In particular, I am missing: * magic_descriptor * All of the flags (e.g. MAGIC_NO_* are missing[1]) Thanks, ~Niels [1] From https://github.com/file/file/blob/master/src/magic.h.in: #define MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */ #define MAGIC_NO_CHECK_TAR 0x002000 /* Don't check for tar files */ #define MAGIC_NO_CHECK_SOFT 0x004000 /* Don't check magic entries */ #define MAGIC_NO_CHECK_APPTYPE 0x008000 /* Don't check application type */ #define MAGIC_NO_CHECK_ELF 0x010000 /* Don't check for elf details */ #define MAGIC_NO_CHECK_TEXT 0x020000 /* Don't check for text files */ #define MAGIC_NO_CHECK_CDF 0x040000 /* Don't check for cdf files */ #define MAGIC_NO_CHECK_TOKENS 0x100000 /* Don't check tokens */ #define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */ #define MAGIC_NO_CHECK_BUILTIN ... And possibly others.
On Mon Oct 13 18:29:50 2014, niels@thykier.net wrote: Show quoted text
> Hi, > > Thanks for making File::LibMagic. > > I would like to have more of File::LibMagic's API exposed, e.g. via the > ":complete" import tag. In particular, I am missing: > > * magic_descriptor > * All of the flags (e.g. MAGIC_NO_* are missing[1])
The :complete API is deprecated, but I can certainly add support for checking the type of an open handle. I could also add support for the constants to the OO api in some way, though not necessarily by exporting the constants. It might be better to offer these as additional parameters to be passed to the methods. Of course, patches are welcome, preferably in the form of pull requests against https://github.com/autarch/File-LibMagic Cheers, -dave
I've added a method to get the magic info of a filehandle in the 1.08 release.