You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/04/12 00:53:14 UTC

cvs commit: modperl-2.0/xs/ModPerl/Const Const.pm Const.xs Makefile.PL

dougm       01/04/11 15:53:14

  Added:       xs/ModPerl Makefile.PL
               xs/ModPerl/Const Const.pm Const.xs Makefile.PL
  Log:
  base module for compiling/exporting constants
  
  Revision  Changes    Path
  1.1                  modperl-2.0/xs/ModPerl/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  use ExtUtils::MakeMaker;
  
  WriteMakefile(NAME => "ModPerl",
                VERSION => '0.01');
  
  
  
  1.1                  modperl-2.0/xs/ModPerl/Const/Const.pm
  
  Index: Const.pm
  ===================================================================
  package ModPerl::Const;
  
  use DynaLoader ();
  
  our $VERSION = '0.01';
  our @ISA = qw(DynaLoader);
  
  #dlopen("Const.so", RTDL_GLOBAL);
  sub dl_load_flags { 0x01 }
  
  __PACKAGE__->bootstrap($VERSION);
  
  sub import {
      my $class = shift;
      my $arg;
  
      if ($_[0] and $_[0] =~ /^-compile/) {
          $arg = shift; #just compile the constants subs, export nothing
      }
  
      $arg ||= scalar caller; #compile and export into caller's namespace
  
      $class->compile($arg, @_ ? @_ : ':common');
  }
  
  1;
  
  
  
  1.1                  modperl-2.0/xs/ModPerl/Const/Const.xs
  
  Index: Const.xs
  ===================================================================
  #include "mod_perl.h"
  
  MODULE = ModPerl::Const    PACKAGE = ModPerl::Const
  
  BOOT:
      file = file; /* -Wall */
  
  
  
  1.1                  modperl-2.0/xs/ModPerl/Const/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  use lib qw(../lib);
  use ModPerl::MM ();
  use File::Basename;
  
  my $srcdir = '../../../src/modules/perl';
  #link these two into Const.so so constants can be used outside of httpd
  my @names = map { "modperl_$_" } qw(const constants);
  my @obj;
  
  for (@names) {
      my $srcfile = join '.', "$srcdir/$_", 'c';
      my $lnfile = join '.', $_, 'c';
      push @obj, join '.', $_, 'o';
      unlink $lnfile;
      symlink $srcfile, $lnfile;
  }
  
  ModPerl::MM::WriteMakefile(
      NAME => 'ModPerl::Const',
      VERSION_FROM => 'Const.pm',
      OBJECT => "Const.o @obj",
  );