The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

File::LibMagic - Perlwrapper for libmagic

SYNOPSIS

The easy way:

          use File::LibMagic ':easy';

          print MagicBuffer("Hello World\n"),"\n";
          # returns "ASCII text"

          print MagicFile("/bin/ls"),"\n";
          # returns "ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV)"
          # on my system

To use all capabilities of libmagic use

          use File::LibMagic ':complete';

          my $handle=magic_open(0);
          my $ret   =magic_load($handle,"");

          print magic_buffer($handle,"Hello World\n"),"\n";
          print magic_file($handle,"/bin/ls"),"\n";

          magic_close($handle);

Please have a look at the files in the example-directory.

ABSTRACT

The File::LibMagic is a simple perl interface to libmagic from the file-4.x package from Christos Zoulas (ftp://ftp.astron.com/pub/file/)

DESCRIPTION

The File::LibMagic is a simple perlinterface to libmagic from the file-4.x package from Christos Zoulas (ftp://ftp.astron.com/pub/file/).

EXPORT

None by default.

BUGS

I'm still learning perlxs ...

still no real error handling (printf is not enough)
magic_load is not implemented yet

HISTORY

April 2004 initial Release

April 2005 version 0.81

Thanks to James Olin Oden (joden@lee.k12.nc.us) for his help. Thanks to Nathan Hawkins <utsl@quic.net> for his port to 64-bit systems.

AUTHOR

Andreas Fitzner <fitzner@informatik.hu-berlin.de>

COPYRIGHT AND LICENSE

Copyright 2005 by Andreas Fitzner

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.