dougm 01/05/02 22:41:02
Modified:lib/ModPerl FunctionMap.pm WrapXS.pm
Log:
add BOOT keyword to indicate a function should be called at BOOT time
Revision ChangesPath
1.8 +4 -1 modperl-2.0/lib/ModPerl/FunctionMap.pm
Index: FunctionMap.pm
===
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/FunctionMap.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FunctionMap.pm2001/05/03 04:56:31 1.7
+++ FunctionMap.pm2001/05/03 05:41:02 1.8
@@ -57,7 +57,7 @@
return @missing ? \@missing : undef;
}
-my $keywords = join '|', qw(MODULE PACKAGE PREFIX);
+my $keywords = join '|', qw(MODULE PACKAGE PREFIX BOOT);
sub guess_prefix {
my $entry = shift;
@@ -129,6 +129,9 @@
}
if ($cur{ISA}) {
$self->{isa}->{ $cur{MODULE} }->{$package} = delete $cur{ISA};
+}
+if ($cur{BOOT}) {
+$self->{boot}->{ $cur{MODULE} } = delete $cur{BOOT};
}
}
else {
1.14 +12 -0 modperl-2.0/lib/ModPerl/WrapXS.pm
Index: WrapXS.pm
===
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- WrapXS.pm 2001/05/03 04:56:31 1.13
+++ WrapXS.pm 2001/05/03 05:41:02 1.14
@@ -378,6 +378,17 @@
$str;
}
+sub boot {
+my($self, $module) = @_;
+my $str = "";
+
+if (my $boot = $self->typemap->{function_map}->{boot}->{$module}) {
+$str = 'mpxs_' . $self->cname($module) . "_BOOT(aTHXo);\n";
+}
+
+$str;
+}
+
sub write_xs {
my($self, $module, $functions) = @_;
@@ -428,6 +439,7 @@
print $fh "PROTOTYPES: disabled\n\n";
print $fh "BOOT:\n";
+print $fh $self->boot($module);
print $fh "items = items; /* -Wall */\n\n";
if (my $newxs = $self->{newXS}->{$module}) {