is an execution of require
wrapped in a BEGIN
block. Because you have package
pack_B in the same file as package pack_A, you are failing the require. So the solution is to add the export text (as Corion
says) and then invoke import directly, i.e. pack_B->import
The better way (IMHO) to do this is to actually respect the package system intent and put pack_B in a different file, and don't surprise your maintainers.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.