Differences between version 2 and previous revision of perlxstut(1).
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Monday, June 3, 2002 6:50:54 pm | by perry | Revert |
Older page: | version 1 | Last edited on Monday, June 3, 2002 6:50:54 pm | by perry | Revert |
@@ -71,9 +71,9 @@
performed automatically, guided by ''CPAN
.pm'' module or other tools.
-In MakeMaker-based installations, ''Makefile.PL''
+In !
MakeMaker-based installations, ''Makefile.PL''
provides the earliest opportunity to perform version checks.
One can put something like this in ''Makefile.PL'' for
this purpose:
@@ -139,22 +139,22 @@
The file Makefile.PL should look something like
this:
- use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+ use !
ExtUtils::!
MakeMaker;
+# See lib/!
ExtUtils/!
MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
-WriteMakefile(
+!
WriteMakefile(
NAME =
The file Mytest.pm should start with something like this:
package Mytest;
use strict;
use warnings;
require Exporter;
-require DynaLoader;
- our @ISA = qw(Exporter DynaLoader);
+require !
DynaLoader;
+ our @ISA = qw(Exporter !
DynaLoader);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
our @EXPORT = qw(
@@ -208,9 +208,9 @@
configured to use PerlCRT, you have to make sure PerlCRT.lib
is copied to the same location that msvcrt.lib lives in, so
that the compiler can find it on its own. msvcrt.lib is
usually found in the Visual C compiler's lib directory (e.g.
-C:/DevStudio/VC/lib).
+C:/!
DevStudio/VC/lib).
Perl has its own special way of easily writing test scripts,
but for this example only, we'll create our own test script.
@@ -218,9 +218,9 @@
this:
#! /opt/perl5/bin/perl
- use ExtUtils::testlib;
+ use !
ExtUtils::testlib;
use Mytest;
Mytest::hello();
Now we make the script executable (chmod -x hello), run the script and we should see the following output:
@@ -485,9 +485,9 @@
The __xsubpp__ program uses rules to convert from Perl's
data types (scalar, array, etc.) to C's data types (int,
char, etc.). These rules are stored in the typemap file
-($PERLLIB/ExtUtils/typemap). This file is split into three
+($PERLLIB/!
ExtUtils/typemap). This file is split into three
parts.
The first section maps various C data types to a name, which
@@ -561,11 +561,11 @@
}
And finally create a file Makefile.PL that looks like this:
- use ExtUtils::MakeMaker;
+ use !
ExtUtils::!
MakeMaker;
$Verbose = 1;
-WriteMakefile(
+!
WriteMakefile(
NAME =
sub MY::top_targets {
'
all :: static
@@ -591,12 +591,12 @@
The normal Makefile.PL that h2xs generates doesn't know
about the mylib directory. We need to tell it that there is
a subdirectory and that we will be generating a library in
it. Let's add the argument MYEXTLIB to the
-WriteMakefile call so that it looks like this:
+!
WriteMakefile call so that it looks like this:
- WriteMakefile(
+ !
WriteMakefile(
'NAME' =
and then at the end add a subroutine (which will override the pre-existing subroutine). Remember to use a tab character to indent the line beginning with ``cd''!
@@ -683,9 +683,9 @@
We've also told Perl about the library that we built in the
mylib subdirectory. That required only the addition of the
-MYEXTLIB variable to the WriteMakefile call and the
+MYEXTLIB variable to the !
WriteMakefile call and the
replacement of the postamble subroutine to cd into the
subdirectory and run make. The Makefile.PL for the library
is a bit more complicated, but not excessively so. Again we
replaced the postamble subroutine to insert our own code.
@@ -941,9 +941,9 @@
routines should live in the .pm file. Whether they are
automatically loaded when the extension itself is loaded or
only loaded when called depends on where in the .pm file the
subroutine definition is placed. You can also consult
-AutoLoader for an alternate way to store and load your extra
+!
AutoLoader for an alternate way to store and load your extra
subroutines.
__Documenting your Extension__