perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/lib/ModPerl WrapXS.pm
Date Thu, 19 Apr 2001 17:24:46 GMT
dougm       01/04/19 10:24:46

  Modified:    lib/ModPerl WrapXS.pm
  Log:
  ablity to add code to the generate .pm
  
  Revision  Changes    Path
  1.6       +29 -2     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WrapXS.pm	2001/04/06 21:31:58	1.5
  +++ WrapXS.pm	2001/04/19 17:24:43	1.6
  @@ -57,8 +57,9 @@
       my $typemap = $self->typemap;
   
       for my $entry (@{ $self->function_list() }) {
  -        my $func;
  -        next unless $func = $typemap->map_function($entry);
  +        my $func = $typemap->map_function($entry);
  +        #print "FAILED to map $entry->{name}\n" unless $func;
  +        next unless $func;
   
           my($name, $module, $class, $args) =
             @{ $func } { qw(perl_name module class args) };
  @@ -311,6 +312,22 @@
       undef;
   }
   
  +sub mod_pm {
  +    my($self, $module, $complete) = @_;
  +
  +    my $dirname = $self->class_dirname($module);
  +    my($base, $sub) = split '::', $module;
  +    my $mod_pm = "$dirname/${sub}_pm";
  +
  +    for ($self->{XS_DIR}, @{ $self->{glue_dirs} }) {
  +        my $file = "$_/$mod_pm";
  +        $mod_pm = $file if $complete;
  +        return $mod_pm if -e $file;
  +    }
  +
  +    undef;
  +}
  +
   sub class_c_prefix {
       my $class = shift;
       $class =~ s/:/_/g;
  @@ -417,6 +434,14 @@
   
       my $isa = $self->isa_str($module);
   
  +    my $code = "";
  +    if (my $mod_pm = $self->mod_pm($module, 1)) {
  +        open my $fh, '<', $mod_pm;
  +        local $/;
  +        $code = <$fh>;
  +        close $fh;
  +    }
  +
       my $fh = $self->open_class_file($module, '.pm');
       print $fh <<EOF;
   $self->{noedit_warning_hash}
  @@ -425,6 +450,8 @@
   $isa
   use XSLoader ();
   XSLoader::load __PACKAGE__;
  +
  +$code
   
   1;
   __END__
  
  
  

Mime
View raw message