Chapter 10
Listing 10 2. MIME.pm with a Single C Function Wrapper
package Gnome::MIME;
our $VERSION = "0.01";
use Inline C => DATA ,
NAME => "Gnome::MIME",
VERSION => "0.01",
LIBS => gnome config gnome libs ,
INC => gnome config gnome cflags ;
1;
__DATA__
__C__
#include
char * file_type (char *filename) {
return gnome_mime_type(filename);
}
This module uses Inline::C differently from the inline.pl script shown at the
beginning of the chapter. Instead of passing the C code in a string, this code points
Inline::C at the __DATA__ section where the code will follow a __C__ identifier:
use Inline C => DATA ,
The next lines specify the name and version of the module. This information is
slightly redundant, but Inline::C uses these options as a cue that it's building C
code for a module and not a script:
NAME => "Gnome::MIME",
VERSION => "0.01",
Next comes the configuration data that the XS version set up in Makefile.PL,
LIBS, and INC:
LIBS => gnome config gnome libs ,
INC => gnome config gnome cflags ;
242
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved