question: public static void processDefinedPackagesForPsiElement ( PsiElement element , Processor < Collection < PerlNamespaceDefinition > > processor ) { if ( element == null ) { return ; } final Project project = element . getProject ( ) ; final GlobalSearchScope elementResolveScope = element . getResolveScope ( ) ; for ( String packageName : PerlPackageUtil . getDefinedPackageNames ( project ) ) { if ( packageName . length ( ) > 0 && Character . isLetterOrDigit ( packageName . charAt ( 0 ) ) ) { Collection < PerlNamespaceDefinition > namespaceDefinitions = PerlPackageUtil . getNamespaceDefinitions ( project , packageName , elementResolveScope ) ; if ( namespaceDefinitions . size ( ) > 0 ) { processor . process ( namespaceDefinitions ) ; } } } }
target:  Finds and processes all namespace definitions for psi element, according to it's resolve scope