cvs commit: modperl-2.0/xs/APR/APR APR.pm

2001-09-12 Thread dougm

dougm   01/09/12 19:40:33

  Modified:xs/APR/APR APR.pm
  Log:
  only bootstrap outside of mod_perl
  
  Revision  ChangesPath
  1.2   +4 -1  modperl-2.0/xs/APR/APR/APR.pm
  
  Index: APR.pm
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/APR/APR.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- APR.pm2001/03/05 03:51:16 1.1
  +++ APR.pm2001/09/13 02:40:33 1.2
  @@ -7,7 +7,10 @@
   #dlopen("APR.so", RTDL_GLOBAL); so we only need to link libapr.a once
   sub dl_load_flags { 0x01 }
   
  -__PACKAGE__->bootstrap($VERSION);
  +unless (defined &APR::XSLoader::BOOTSTRAP) {
  +__PACKAGE__->bootstrap($VERSION);
  +*APR::XSLoader::BOOTSTRAP = sub () { 1 };
  +}
   
   1;
   __END__
  
  
  



cvs commit: modperl-2.0/xs/APR/APR APR.pm APR.xs Makefile.PL apr-test

2001-03-04 Thread dougm

dougm   01/03/04 19:51:16

  Added:   xs/APR/APR APR.pm APR.xs Makefile.PL apr-test
  Log:
  module for using APR outside of Apache
  
  Revision  ChangesPath
  1.1  modperl-2.0/xs/APR/APR/APR.pm
  
  Index: APR.pm
  ===
  package APR;
  
  use DynaLoader ();
  our $VERSION = '0.01';
  our @ISA = qw(DynaLoader);
  
  #dlopen("APR.so", RTDL_GLOBAL); so we only need to link libapr.a once
  sub dl_load_flags { 0x01 }
  
  __PACKAGE__->bootstrap($VERSION);
  
  1;
  __END__
  
  
  
  1.1  modperl-2.0/xs/APR/APR/APR.xs
  
  Index: APR.xs
  ===
  #include "mod_perl.h"
  
  MODULE = APRPACKAGE = APR
  
  BOOT:
  file = file; /* -Wall */
  apr_initialize();
  
  void
  END()
  
  CODE:
  apr_terminate();
  
  
  
  1.1  modperl-2.0/xs/APR/APR/Makefile.PL
  
  Index: Makefile.PL
  ===
  use ExtUtils::MakeMaker;
  
  use lib qw(../lib);
  use ModPerl::MM ();
  use Config;
  
  my $root = ModPerl::MM::build_config('dir') || "";
  my $srclib = "$root/srclib";
  my $apr = "$srclib/apr";
  
  my @libs;
  if ($root) {
  @libs = join ' ',
"-L$apr/.libs -lapr",
  "-L$srclib/apr-util/.libs -laprutil",
"-L$srclib/expat-lite/.libs -lexpat",
  "-L$apr/shmem/unix/mm/.libs -lmm";
  }
  
  ModPerl::MM::WriteMakefile(
  'NAME'=> 'APR',
  'VERSION_FROM' => 'APR.pm',
  'LIBS' => \@libs,
  );
  
  sub MY::const_loadlibs {
  my $self = shift;
  
  my $string = $self->MM::const_loadlibs;
  return $string unless $Config{gccversion}; #XXX
  
  my $wa = '-Wl,--whole-archive';
  my $nwa = '-Wl,--no-whole-archive';
  
  $string =~ s/(LDLOADLIBS\s*=\s*)(.*)/$1$wa $2 $nwa/;
  $string;
  }
  
  
  
  1.1  modperl-2.0/xs/APR/APR/apr-test
  
  Index: apr-test
  ===
  #!perl
  
  use Test;
  
  plan tests => 10;
  
  use blib;
  use warnings FATAL => 'all';
  use strict;
  use APR ();
  use APR::UUID ();
  use APR::Pool ();
  use APR::Lock ();
  use APR::Lib ();
  use APR::Base64 ();
  use APR::Signal ();
  
  my $status;
  
  my $uuid = APR::UUID->new->format;
  
  ok $uuid;
  
  my $p = APR::Pool->new;
  
  my $num_bytes = $p->num_bytes;
  
  ok $num_bytes;
  
  #print "begin bytes=$num_bytes\n";
  
  ok $p;
  
  my $lock = APR::Lock->new($p, 0, 1, "lock.file");
  $status = $lock->acquire and die APR::strerror($status);
  $status = $lock->release and die APR::strerror($status);
  
  $status = APR::password_validate("one", "two");
  my $str = APR::strerror($status);
  ok $str eq "passwords do not match";
  
  ok $status;
  
  my $bytes = APR::generate_random_bytes(10);
  
  ok length($bytes) == 10;
  
  my $encoded = APR::Base64::encode($bytes);
  
  #print "encoded=$encoded\n";
  
  ok $encoded;
  
  my $decoded = APR::Base64::decode($encoded);
  
  ok $decoded eq $bytes;
  
  $p->clear;
  
  while ($num_bytes == $p->num_bytes) {
  APR::Lock->new($p);
  }
  
  my $cur_num_bytes = $p->num_bytes;
  
  #print "end bytes=$cur_num_bytes\n";
  
  ok (($cur_num_bytes / 2) == $num_bytes);
  
  for (1..9) {
  my $desc = APR::Signal::get_description($_);
  #print "$_ => $desc\n";
  }
  
  ok 1;
  
  $p->destroy; #XXX