Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl-hive
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
7
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl-hive
Commits
ad03106b
Commit
ad03106b
authored
12 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
new function for finding all modules in a "directory" across the whole INC list
parent
da4b0bb0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Hive/Utils.pm
+32
-1
32 additions, 1 deletion
modules/Bio/EnsEMBL/Hive/Utils.pm
with
32 additions
and
1 deletion
modules/Bio/EnsEMBL/Hive/Utils.pm
+
32
−
1
View file @
ad03106b
...
...
@@ -43,7 +43,7 @@ use warnings;
use
Data::
Dumper
;
use
Exporter
'
import
';
our
@EXPORT_OK
=
qw( stringify destringify dir_revhash parse_cmdline_options load_file_or_module script_usage url2dbconn_hash)
;
our
@EXPORT_OK
=
qw( stringify destringify dir_revhash parse_cmdline_options
find_submodules
load_file_or_module script_usage url2dbconn_hash)
;
=head2 stringify
...
...
@@ -148,6 +148,37 @@ sub parse_cmdline_options {
}
=head2 find_submodules
Description: This function takes one argument ("prefix" of a module name),
transforms it into a directory name from the filesystem's point of view
and finds all module names in these "directories".
Each module_name found is reported only once,
even if there are multiple matching files in different directories.
Callers : scripts
=cut
sub
find_submodules
{
my
$prefix
=
shift
@_
;
$prefix
=~
s{::}{/}g
;
my
%seen_module_name
=
();
foreach
my
$inc
(
@INC
)
{
foreach
my
$full_module_path
(
<
$inc
/$prefix/
*.
pm
>
)
{
my
$module_name
=
substr
(
$full_module_path
,
length
(
$inc
)
+
1
,
-
3
);
# remove leading "$inc/" and trailing '.pm'
$module_name
=~
s{/}{::}g
;
# transform back to module_name space
$seen_module_name
{
$module_name
}
++
;
}
}
return
[
keys
%seen_module_name
];
}
=head2 load_file_or_module
Description: This function takes one argument, tries to determine whether it is a module name ('::'-separated)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment