For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2004 > h2xs difficulties









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author h2xs difficulties
David Cannings

2004-04-25, 9:32 pm

At some point in the past somebody has used h2xs to create a Perl module
called "Exim::LocalScan" which works fine. I am now trying to reproduce
this but am not having much luck.

The source directory I have for the working module has various files such
as LocalScan.xs which includes the definition for a function from the
header file, like so:

"void header_add(type, format, data)
int type
char * format"
(.. etc ..)

When I try to use the tool h2xs I get results that I would not expect
after reading the manual page. I am following the example listed in the
manpage in order to help.

First I run `h2xs -Afn Exim::LocalScan` to create the directory.
According to the manpage this should create Exim/LocalScan but it
actually creates Exim-LocalScan, this is the first confusing issue I'm
having. Next I copy the header and source files (local_scan.[c/h]) to
this directory and the nrun the next command suggested in the manpage:

# h2xs -AOxan Exim::LocalScan -L/root/exim4-4.31/src local_scan.h

I include the directory above as the header file relies on certain files
from it. Now if I look at the generated LocalScan.xs it lacks the
function definition that the previous one had, however the header file
local_scan.h has:

"extern void header_add(int, char *, ...);"

Also, the file LocalScan.pm, which seems to have moved from the root
directory into ./lib/Exim/, doesn't have the values from enums or
#defines. The previous version has sections similar to the one below,
the one I have generated seems to have nothing except the default generic
statements.

"# Preloaded methods go here.
sub LOCAL_SCAN_ACCEPT { return 0; }"

What is there that I'm missing? I'm guessing using h2xs must be much
simpler than this, I'm just not very experienced with Perl.

David
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com