Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re: [PATCH 5.005_57] decrease memory footprint of standard modules #235

Closed
p5pRT opened this issue Jul 27, 1999 · 1 comment
Closed

Re: [PATCH 5.005_57] decrease memory footprint of standard modules #235

p5pRT opened this issue Jul 27, 1999 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Jul 27, 1999

Migrated from rt.perl.org#1043 (status was 'resolved')

Searchable as RT1043$

@p5pRT
Copy link
Author

p5pRT commented Jul 27, 1999

From ilya@math.ohio-state.edu

This is only 95% my fault, all the rest is yours! ;-)

I saw this failure, but this was exactly the mode of failure after one
of my experimental REx patches, so I thought that I was editing in a
wrong directory with that patch applied. (I've lost count on how many
patched 5.005_57 directories do I have around.)

Better patch follows, thanks,
Ilya

Inline Patch
--- ././configpm.orig	Tue Jul  6 06:33:22 1999
+++ ././configpm	Mon Jul 26 15:56:28 1999
@@ -19,13 +19,24 @@ my $glossary = $ARGV[1] || 'Porting/Glos
 open CONFIG, ">$config_pm" or die "Can't open $config_pm: $!\n";
 $myver = $];
 
-print CONFIG <<"ENDOFBEG";
+print CONFIG <<'ENDOFBEG_NOQ', <<"ENDOFBEG";
 package Config;
 use Exporter ();
-\@ISA = (Exporter);
-\@EXPORT = qw(%Config);
-\@EXPORT_OK = qw(myconfig config_sh config_vars);
+@EXPORT = qw(%Config);
+@EXPORT_OK = qw(myconfig config_sh config_vars);
 
+# Define our own import method to avoid pulling in the full Exporter:
+sub import {
+  my $pkg = shift;
+  @_ = @EXPORT unless @_;
+  my @func = grep {$_ ne '%Config'} @_;
+  Exporter::import('Config', @func) if @func;
+  return if @func == @_;
+  my $callpkg = caller(0);
+  *{"$callpkg\::Config"} = \%Config;
+}
+
+ENDOFBEG_NOQ
 \$] == $myver
   or die "Perl lib version ($myver) doesn't match executable version (\$])";
 
--- ././lib/SelfLoader.pm.orig	Tue Jul  6 06:34:16 1999
+++ ././lib/SelfLoader.pm	Mon Jul 26 00:23:23 1999
@@ -1,5 +1,5 @@
 package SelfLoader;
-use Carp;
+# use Carp;
 require Exporter;
 @ISA = qw(Exporter);
 @EXPORT = qw(AUTOLOAD);
@@ -9,6 +9,8 @@ $DEBUG = 0;
 
 my %Cache;      # private cache for all SelfLoader's client packages
 
+sub croak { require Carp; goto &Carp::croak }
+
 AUTOLOAD {
     print STDERR "SelfLoader::AUTOLOAD for $AUTOLOAD\n" if $DEBUG;
     my $SL_code = $Cache{$AUTOLOAD};
@@ -92,7 +94,8 @@ sub _load_stubs {
 sub _add_to_cache {
     my($self,$fullname,$pack,$lines, $protoype) = @_;
     return () unless $fullname;
-    carp("Redefining sub $fullname") if exists $Cache{$fullname};
+    (require Carp), Carp::carp("Redefining sub $fullname")
+      if exists $Cache{$fullname};
     $Cache{$fullname} = join('', "package $pack; ",@$lines);
     print STDERR "SelfLoader cached $fullname: $Cache{$fullname}" if $DEBUG;
     # return stub to be eval'd
--- ././lib/AutoLoader.pm.orig	Tue Jul  6 06:34:05 1999
+++ ././lib/AutoLoader.pm	Mon Jul 26 21:35:21 1999
@@ -1,17 +1,17 @@
 package AutoLoader;
 
-use vars qw(@EXPORT @EXPORT_OK $VERSION);
+# use vars qw(@EXPORT @EXPORT_OK $VERSION);
 
 my $is_dosish;
 my $is_vms;
 
 BEGIN {
     require Exporter;
-    @EXPORT = ();
-    @EXPORT_OK = qw(AUTOLOAD);
+    @EXPORT = @EXPORT = ();
+    @EXPORT_OK = @EXPORT_OK = qw(AUTOLOAD);
     $is_dosish = $^O eq 'dos' || $^O eq 'os2' || $^O eq 'MSWin32';
     $is_vms = $^O eq 'VMS';
-    $VERSION = '5.56';
+    $VERSION = $VERSION = '5.57';
 }
 
 AUTOLOAD {
@@ -103,7 +103,10 @@ sub import {
     # Export symbols, but not by accident of inheritance.
     #
 
-    Exporter::export $pkg, $callpkg, @_ if $pkg eq 'AutoLoader';
+    if ($pkg eq 'AutoLoader') {
+      local $Exporter::ExportLevel = 1;
+      Exporter::import $pkg, @_;
+    }
 
     #
     # Try to find the autosplit index file.  Eg., if the call package
--- ././ext/POSIX/POSIX.pm.orig	Tue Jul  6 06:33:42 1999
+++ ././ext/POSIX/POSIX.pm	Mon Jul 26 16:07:36 1999
@@ -1,6 +1,7 @@
 package POSIX;
 
-use vars qw($VERSION @ISA %EXPORT_TAGS @EXPORT_OK $AUTOLOAD); 
+# use vars qw($VERSION @ISA %EXPORT_TAGS @EXPORT_OK $AUTOLOAD); 
+(@ISA, %EXPORT_TAGS,@EXPORT_OK,$AUTOLOAD) = ();
 
 use Carp;
 use AutoLoader;
@@ -11,7 +12,7 @@ require Exporter;
 require DynaLoader;
 @ISA = qw(Exporter DynaLoader);
 
-$VERSION = "1.02" ;
+$VERSION = $VERSION = "1.03" ;
 
 %EXPORT_TAGS = (
 
@@ -161,7 +162,10 @@ $VERSION = "1.02" ;
 
 );
 
-Exporter::export_tags();
+# Exporter::export_tags();
+for (values %EXPORT_TAGS) {
+  push @EXPORT, @$_;
+}
 
 @EXPORT_OK = qw(
     closedir opendir readdir rewinddir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant