develooper Front page | perl.perl5.porters | Postings from April 2000

Weird 'use base ...' effect of "static link"

Nick Ing-Simmons
April 29, 2000 07:50
Weird 'use base ...' effect of "static link"
Message ID:

Debugging my "convert script to executable" scheme has shown up 
another oddity of 5.005_03's ''

If you have (say)

use base qw(Tk::Text);

Then you hit

package base;

sub import {
    my $class = shift;
    my $fields_base;

    foreach my $base (@_) {
	unless (defined %{"$base\::"}) {
	    eval "require $base";

Now leaving aside that that is using defined on a hash - which is 
alleged to be pointless - to see if package exists. The existance test 
seems to work in this case.

If Tk::Text is Dynamic linked and not yet loaded the require happens
as I expected. 

BUT - if you have statically linked Tk::Text (using 
ExtUtils::Miniperl to build a perlmain) then there has been 
a newXS("Tk::Text::bootstrap",...) at xs_init time and so "stash" 
exists and require does not happen so perl part of Tk::Text package
is never created. What fun :-}

5.6.0's does not have the problem.

Nick Ing-Simmons Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About