Then how could I possibly use the value of $path? Must I put everything into the import subroutine?
No, not everything... You can use it in any other method that you call at run time. But top level code runs at compile time — i.e. in the
require step. Before the
import step, just like pfaut said.
Just print the "Hello" in the import routine.
From the above code, how could I export the users hash?
In import, call SUPER::import. Or Exporter::import. Just make sure the arguments to the call are right.