in reply to Default import function

The "import" method is special-cased. For Foo->import(), when the import method is looked up and not found, a special value (&PL_sv_yes) is returned for the lookup, rather than croaking as would happen for any other method name. Then the subroutine-calling code (pp_entersub) is special-cased to return immediately if the CV passed to it is &PL_sv_yes.

This is an implementation detail and is subject to change. But it doesn't create an import() sub, nor does it rely on the existence of UNIVERSAL::import.

Dave.

Replies are listed 'Best First'.
Re^2: Default import function
by 1nickt (Canon) on Oct 24, 2016 at 13:37 UTC

    Whenever there's a thread like this and the answer is shared by someone who definitively knows, I murmur a chant of gratitude: thank gods that there's someone who does know.

    Whenever someone lifts the lid a crack on the guts of perl, I am truly overwhelmed with gratitude for all the builders and tenders over the years who have made it possible for me to earn a living doing what I love.

    The way forward always starts with a minimal test.