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
38085193
Commit
38085193
authored
14 years ago
by
Leo Gordon
Browse files
Options
Downloads
Patches
Plain Diff
perldocs added
parent
d5e785e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Hive/Utils.pm
+46
-25
46 additions, 25 deletions
modules/Bio/EnsEMBL/Hive/Utils.pm
with
46 additions
and
25 deletions
modules/Bio/EnsEMBL/Hive/Utils.pm
+
46
−
25
View file @
38085193
package
Bio::EnsEMBL::Hive::
Utils
;
=pod
=head1 NAME
Bio::EnsEMBL::Hive::Utils
=head1 DESCRIPTION
Let's keep here various utility functions that are not proper Extensions (do not cunningly extend other classes)
=head1 SYNOPSIS
You can either inherit from this package, call the functions directly or import:
# Example of an import:
use Bio::EnsEMBL::Hive::Utils 'stringify';
my $input_id_string = stringify($input_id_hash);
# Example of inheritance:
use base ('Bio::EnsEMBL::Hive::Utils', ...);
my $input_id_string = $self->stringify($input_id_hash);
=head1 Example of inheritance:
# Example of a direct call:
use Bio::EnsEMBL::Hive::Utils;
my $input_id_string = Bio::EnsEMBL::Hive::Utils::stringify($input_id_hash);
use base ('Bio::EnsEMBL::Hive::Utils', ...);
my $input_id_string = $self->stringify($input_id_hash);
=head1 DESCRIPTION
This module provides general utility functions (at the moment of documentation, 'stringify' and 'destringify')
that can be used in different contexts using three different calling mechanisms:
* import: another module/script can selectively import methods from this module into its namespace
=head1 Example of a direct call:
* inheritance: another module can inherit from this one and so implicitly acquire the methods into its namespace
* direct call to a module's method: another module/script can directly call a method from this module prefixed with this module's name
use Bio::EnsEMBL::Hive::Utils;
=head1 CONTACT
my $input_id_string = Bio::EnsEMBL::Hive::Utils::stringify($input_id_hash);
Please contact ehive-users@ebi.ac.uk mailing list with questions/suggestions.
=cut
package
Bio::EnsEMBL::Hive::
Utils
;
=head1 Example of import:
use
strict
;
use
warnings
;
use
Data::
Dumper
;
use Bio::EnsEMBL::Hive::Utils 'stringify';
use
Exporter
'
import
';
our
@EXPORT_OK
=
qw( stringify destringify )
;
my $input_id_string = stringify($input_id_hash);
=head2 stringify
=head1 Author
Description: This function takes in a Perl data structure and stringifies it using specific configuration
that allows us to store/recreate this data structure according to our specific storage/communication requirements.
Leo Gordon, lg4@ebi.ac.uk
Callers : Bio::EnsEMBL::Hive::DBSQL::AnalysisJobAdaptor # stringification of input_id() hash
Bio::EnsEMBL::Hive::PipeConfig::HiveGeneric_conf # stringification of parameters() hash
=cut
use
strict
;
use
warnings
;
use
Data::
Dumper
;
use
Exporter
'
import
';
our
@EXPORT_OK
=
qw( stringify destringify )
;
sub
stringify
{
my
$structure
=
pop
@_
;
...
...
@@ -59,7 +69,18 @@ sub stringify {
return
Dumper
(
$structure
);
}
sub
destringify
{
# eval if it seems to be a perl hash/array/string and leave intact otherwise
=head2 destringify
Description: This function takes in a string that may or may not contain a stingified Perl structure.
If it seems to contain a hash/array/quoted_string, the contents is evaluated, otherwise it is returned "as is".
This function is mainly used to read values from 'meta' table that may represent Perl structures, but generally don't have to.
Callers : Bio::EnsEMBL::Hive::ProcessWithParams # destringification of general 'meta' params
beekeeper.pl script # destringification of the 'pipeline_name' meta param
=cut
sub
destringify
{
my
$value
=
pop
@_
;
if
(
$value
)
{
...
...
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