=item B<-A>
Omit all autoload facilities. This is the same as B<-c> but also removes the
-S<C<require AutoLoader>> statement from the .pm file.
+S<C<use AutoLoader>> statement from the .pm file.
=item B<-F>
=item B<-X>
Omit the XS portion. Used to generate templates for a module which is not
-XS-based.
+XS-based. C<-c> and C<-f> are implicitly enabled.
=item B<-c>
-F Additional flags for C preprocessor (used with -x).
-O Allow overwriting of a pre-existing extension directory.
-P Omit the stub POD section.
- -X Omit the XS portion.
+ -X Omit the XS portion (implies both -c and -f).
-c Omit the constant() function and specialised AUTOLOAD from the XS file.
-d Turn on debugging messages.
-f Force creation of the extension even if the C header does not exist.
if( $opt_v ){
$TEMPLATE_VERSION = $opt_v;
}
+
+# -A implies -c.
$opt_c = 1 if $opt_A;
+
+# -X implies -c and -f
+$opt_c = $opt_f = 1 if $opt_X;
+
%const_xsub = map { $_,1 } split(/,+/, $opt_s) if $opt_s;
while (my $arg = shift) {
require DynaLoader;
END
-# require autoloader if XS is disabled.
-# if XS is enabled, require autoloader unless autoloading is disabled.
-if( ($opt_X && (! $opt_A)) || (!$opt_X) ) {
- print PM <<"END";
-require AutoLoader;
-END
-}
-
-if( $opt_X || ($opt_c && ! $opt_A) ){
- # we won't have our own AUTOLOAD(), so we'll inherit it.
- if( ! $opt_X ) { # use DynaLoader, unless XS was disabled
- print PM <<"END";
-\@ISA = qw(Exporter AutoLoader DynaLoader);
-END
+# Are we using AutoLoader or not?
+unless ($opt_A) { # no autoloader whatsoever.
+ unless ($opt_c) { # we're doing the AUTOLOAD
+ print PM "use AutoLoader;\n";
}
- else{
- print PM <<"END";
-
-\@ISA = qw(Exporter AutoLoader);
-END
+ else {
+ print PM "use AutoLoader qw(AUTOLOAD);\n"
}
}
-else{
- # 1) we have our own AUTOLOAD(), so don't need to inherit it.
- # or
- # 2) we don't want autoloading mentioned.
- if( ! $opt_X ){ # use DynaLoader, unless XS was disabled
- print PM <<"END";
-\@ISA = qw(Exporter DynaLoader);
-END
- }
- else{
- print PM <<"END";
-
-\@ISA = qw(Exporter);
-END
- }
-}
+# Determine @ISA.
+my $myISA = '@ISA = qw(Exporter'; # We seem to always want this.
+$myISA .= ' DynaLoader' unless $opt_X; # no XS
+$myISA .= ');';
+print PM "\n$myISA\n\n";
print PM<<"END";
# Items to export into callers namespace by default. Note: do not export
print PM <<"END";
# Preloaded methods go here.
+END
+
+print PM <<"END" unless $opt_A;
# Autoload methods go after $after, and are processed by the autosplit program.
+END
+
+print PM <<"END";
1;
__END__