diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-09-23 13:48:10 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-09-23 13:48:10 +0000 |
commit | f667a15aba5fcf07ed08e48e2bfdf0b62d76a3aa (patch) | |
tree | 06daf6708829753852debb8cc61e20ffc953cdbf /ext | |
parent | b20801968f657f183ff09a100890be83a7f1337c (diff) | |
download | perl-f667a15aba5fcf07ed08e48e2bfdf0b62d76a3aa.tar.gz |
defined %{$package.'::'} isn't good enough to tell whether a module is
loaded when it's XS and staticly linked to perl.
p4raw-id: //depot/perl@34409
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/B/Concise.pm | 15 | ||||
-rw-r--r-- | ext/B/t/concise.t | 7 |
2 files changed, 15 insertions, 7 deletions
diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 7ddf1d7bfb..284f797612 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -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 diff --git a/ext/B/t/concise.t b/ext/B/t/concise.t index 7b4df885f9..5cd554383d 100644 --- a/ext/B/t/concise.t +++ b/ext/B/t/concise.t @@ -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(); }; |