by including arguments of the form B<-L/another/library/path> in the
extra-libraries argument.
+In spite of its name, I<h2xs> may also be used to create a skeleton pure
+Perl module. See the B<-X> option.
+
=head1 OPTIONS
=over 5
=item B<-X>, B<--omit-XS>
-Omit the XS portion. Used to generate templates for a module which is not
-XS-based. C<-c> and C<-f> are implicitly enabled.
+Omit the XS portion. Used to generate a skeleton pure Perl module.
+C<-c> and C<-f> are implicitly enabled.
=item B<-a>, B<--gen-accessors>
# Extension is ONC::RPC.
h2xs -cfn ONC::RPC
+ # Extension is a pure Perl module with no XS code.
+ h2xs -X My::Module
+
# Extension is Lib::Foo which works at least with Perl5.005_03.
# Constants are created for all #defines and enums h2xs can find
# in foo.h.
$sub ? sprintf("%d.%03d%02d",$maj,$min,$sub) :
sprintf("%d.%03d", $maj,$min);
} else {
- $compat_version =
- $sub ? sprintf("%d.%03d%03d",$maj,$min,$sub) :
- sprintf("%d.%03d", $maj,$min);
+ $compat_version = sprintf("%d.%03d%03d",$maj,$min,$sub);
}
} else {
my ($maj,$min,$sub) = $compat_version =~ /(\d+)\.(\d\d\d)(\d*)/;
# Remove C and C++ comments
$src =~ s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#$2#gs;
+ $src =~ s#//.*$##gm;
while ($src =~ /\benum\s*([\w_]*)\s*\{\s([^}]+)\}/gsc) {
my ($enum_name, $enum_body) = ($1, $2);