Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

h2xs for dummies

by ferrency (Deacon)
on Apr 18, 2002 at 16:54 UTC ( [id://160266]=note: print w/replies, xml ) Need Help??


in reply to Re^4: How do I export methods and constants from a package module?
in thread How do I export methods and constants from a package module?

Using h2xs to create XS extensions for perl might be difficult; I don't know, I've never done it before.

However, using h2xs to create empty module templates for modules you'll be writing is extremely easy.

Example:

% h2xs -X -n This::Is::A::Test
This creates a directory tree for module This::Is::A::Test under This/. Directory This/Is/A/Test contains Test.pm, Makefile.PL, MANIFEST, Changes, and test.pl (a test script, unrelated to the naming of Test.pm). Next, edit Test.pm to make it do what you want. To do a complete build and install, do the following in the Test directory:

perl Makefile.PL; make; make test; make install
For more information on this, please check out perldoc ExtUtils::MakeMaker. This gives lots of information about tweaking a Makefile.PL file created by h2xs, as well as how to start from scratch if you really want to.

The .pm file created by h2xs starts out with a standard pod template, Autoloader, and Exporter. If you have the most recent h2xs, it'll build a .pm file which follows the most recent recommendations on the use of Exporter and Autoloader.

I use this technique so regularly now, that I don't know what I ever did without it.

Alan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://160266]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-23 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found