Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
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
Commits
9e6e46e9
Commit
9e6e46e9
authored
11 years ago
by
Alessandro Vullo
Browse files
Options
Downloads
Patches
Plain Diff
Interface to some of the XS optimised implementations
parent
c5a6ee92
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/Utils/Scalar.pm
+17
-7
17 additions, 7 deletions
modules/Bio/EnsEMBL/Utils/Scalar.pm
with
17 additions
and
7 deletions
modules/Bio/EnsEMBL/Utils/Scalar.pm
+
17
−
7
View file @
9e6e46e9
...
...
@@ -102,14 +102,24 @@ $Revision$
use
strict
;
use
warnings
;
#
# Interface with some of the module function XS reimplementation
#
# If Bio::EnsEMBL::XS is installed, assign the function glob to
# the XS counterpart, otherwise assign to the original function
#
BEGIN
{
if
(
eval
{
require
Bio::EnsEMBL::
XS
;
1
})
{
*check_ref
=
\
&
Bio::EnsEMBL::XS::Utils::Scalar::
check_ref
;
*assert_ref
=
\
&
Bio::EnsEMBL::XS::Utils::Scalar::
assert_ref
;
# *assert_numeric = \&Bio::EnsEMBL::XS::Utils::Scalar::assert_numeric;
# *assert_integer = \&Bio::EnsEMBL::XS::Utils::Scalar::assert_integer;
}
else
{
*check_ref
=
\
&check_ref_pp
;
*assert_ref
=
\
&assert_ref_pp
;
# *assert_numeric = \&assert_numeric_pp;
# *assert_integer = \&assert_integer_pp;
}
}
...
...
@@ -481,7 +491,7 @@ sub assert_ref_can {
return
1
;
}
=head2 assert_numeric
=head2 assert_numeric
_pp
Arg [1] : The Scalar to check
Arg [2] : The attribute name you are asserting; not required but allows
...
...
@@ -501,7 +511,7 @@ sub assert_ref_can {
=cut
sub
assert_numeric
{
sub
assert_numeric
_pp
{
my
(
$integer
,
$attribute_name
)
=
@_
;
return
1
unless
$ASSERTIONS
;
$attribute_name
||=
'
-Unknown-
';
...
...
@@ -513,7 +523,7 @@ sub assert_numeric {
return
1
;
}
=head2 assert_integer
=head2 assert_integer
_pp
Arg [1] : The Scalar to check
Arg [2] : The attribute name you are asserting; not required but allows
...
...
@@ -534,11 +544,11 @@ sub assert_numeric {
=cut
sub
assert_integer
{
sub
assert_integer
_pp
{
my
(
$integer
,
$attribute_name
)
=
@_
;
return
1
unless
$ASSERTIONS
;
$attribute_name
||=
'
-Unknown-
';
assert_numeric
(
$integer
,
$attribute_name
);
assert_numeric
_pp
(
$integer
,
$attribute_name
);
if
(
$integer
!=
int
(
$integer
))
{
throw
"
Attribute
$attribute_name
was a number but not an Integer
";
}
...
...
@@ -569,7 +579,7 @@ sub assert_boolean {
my
(
$boolean
,
$attribute_name
)
=
@_
;
return
1
unless
$ASSERTIONS
;
$attribute_name
||=
'
-Unknown-
';
assert_numeric
(
$boolean
,
$attribute_name
);
assert_numeric
_pp
(
$boolean
,
$attribute_name
);
if
(
$boolean
!=
0
&&
$boolean
!=
1
)
{
throw
"
Attribute
$attribute_name
was an invalid boolean. Expected: 1 or 0. Got:
$boolean
";
}
...
...
@@ -600,7 +610,7 @@ sub assert_strand {
my
(
$strand
,
$attribute_name
)
=
@_
;
return
1
unless
$ASSERTIONS
;
$attribute_name
||=
'
-Unknown-
';
assert_numeric
(
$strand
,
$attribute_name
);
assert_numeric
_pp
(
$strand
,
$attribute_name
);
if
(
$strand
!=
-
1
&&
$strand
!=
0
&&
$strand
ne
1
)
{
throw
"
Attribute
$attribute_name
was an invalid strand. Expected: 1, 0 or -1. Got:
$strand
";
}
...
...
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