This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
defined %{$package.'::'} isn't good enough to tell whether a module is
authorNicholas Clark <nick@ccl4.org>
Tue, 23 Sep 2008 13:48:10 +0000 (13:48 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 23 Sep 2008 13:48:10 +0000 (13:48 +0000)
loaded when it's XS and staticly linked to perl.

p4raw-id: //depot/perl@34409

ext/B/B/Concise.pm
ext/B/t/concise.t

index 7ddf1d7..284f797 100644 (file)
@@ -14,7 +14,7 @@ use warnings; # uses #3 and #4, since warnings uses Carp
 
 use Exporter (); # use #5
 
-our $VERSION   = "0.75";
+our $VERSION   = "0.76";
 our @ISA       = qw(Exporter);
 our @EXPORT_OK = qw( set_style set_style_standard add_callback
                     concise_subref concise_cv concise_main
@@ -299,7 +299,18 @@ sub compileOpts {
        elsif ($o =~ /^-stash=(.*)/) {
            my $pkg = $1;
            no strict 'refs';
-           eval "require $pkg" unless defined %{$pkg.'::'};
+           if (!defined %{$pkg.'::'}) {
+               eval "require $pkg";
+           } else {
+               require Config;
+               if (!$Config::Config{usedl}
+                   && keys %{$pkg.'::'} == 1
+                   && $pkg->can('bootstrap')) {
+                   # It is something that we're staticly linked to, but hasn't
+                   # yet been used.
+                   eval "require $pkg";
+               }
+           }
            push @render_packs, $pkg;
        }
        # line-style options
index 7b4df88..5cd5543 100644 (file)
@@ -416,11 +416,8 @@ like($out, qr/FUNC: \*ExtUtils::Mksymlists::_write_vms/,
 $out = runperl ( switches => ["-MO=Concise,-stash=Data::Dumper,-src,-exec"],
                 prog => '-e 1', stderr => 1 );
 
-{
-    local $TODO = q(require $package unless ${$package.'::'}; doesn't do what you want under static linking) unless $Config{usedl};
-    like($out, qr/FUNC: \*Data::Dumper::format_refaddr/,
-         "stash rendering loads package as needed");
-}
+like($out, qr/FUNC: \*Data::Dumper::format_refaddr/,
+     "stash rendering loads package as needed");
 
 my $prog = q{package FOO; sub bar { print "bar" } package main; FOO::bar(); };