Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
0d1278bb
Commit
0d1278bb
authored
Apr 11, 2014
by
Leo Gordon
Browse files
stop relying on Dumper and display more meaningful info about objects being updated
parent
3f3d6c82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
14 deletions
+7
-14
modules/Bio/EnsEMBL/Hive/Cacheable.pm
modules/Bio/EnsEMBL/Hive/Cacheable.pm
+7
-14
No files found.
modules/Bio/EnsEMBL/Hive/Cacheable.pm
View file @
0d1278bb
package
Bio::EnsEMBL::Hive::
Cacheable
;
use
Data::
Dumper
;
use
Bio::EnsEMBL::Hive::
Utils
('
stringify
');
use
Bio::EnsEMBL::Hive::Utils::
Collection
;
...
...
@@ -32,14 +31,11 @@ sub add_new_or_update {
my
%other_pairs
=
@_
;
my
%unikey_pairs
;
@unikey_pairs
{
@$unikey_keys
}
=
delete
@other_pairs
{
@$unikey_keys
};
use
Data::
Dumper
;
local
$
Data::Dumper::
Indent
=
0
;
# we want everything on one line
local
$
Data::Dumper::
Terse
=
1
;
# and we want it without dummy variable names
local
$
Data::Dumper::
Maxdepth
=
1
;
if
(
$self
=
$class
->
collection
()
->
find_one_by
(
%unikey_pairs
)
)
{
my
$found_display
=
UNIVERSAL::
can
(
$self
,
'
toString
')
?
$self
->
toString
:
stringify
(
$self
);
if
(
keys
%other_pairs
)
{
warn
"
Updating
$
class
(
"
.
Dumper
(
\
%unikey_pairs
)
.
"
) with (
"
.
Dumper
(
\
%other_pairs
)
.
"
)
\n
";
warn
"
Updating
$
found_display
with (
"
.
stringify
(
\
%other_pairs
)
.
"
)
\n
";
if
(
ref
(
$self
)
eq
'
HASH
'
)
{
@$self
{
keys
%other_pairs
}
=
values
%other_pairs
;
}
else
{
...
...
@@ -48,7 +44,7 @@ sub add_new_or_update {
}
}
}
else
{
warn
"
Found a matching
$
class
(
"
.
Dumper
(
\
%unikey_pairs
)
.
"
)
\n
";
warn
"
Found a matching
$
found_display
\n
";
}
}
}
else
{
...
...
@@ -56,13 +52,10 @@ sub add_new_or_update {
}
unless
(
$self
)
{
if
(
$class
->
can
('
new
')
)
{
$self
=
$class
->
new
(
@
_
);
warn
"
Created a new
"
.
$self
->
toString
.
"
\n
";
}
else
{
$self
=
{
@
_
};
warn
"
Created a new naked entry
"
.
stringify
(
$self
)
.
"
\n
";
}
$self
=
$class
->
can
('
new
')
?
$class
->
new
(
@
_
)
:
{
@
_
};
my
$found_display
=
UNIVERSAL::
can
(
$self
,
'
toString
')
?
$self
->
toString
:
'
naked entry
'
.
stringify
(
$self
);
warn
"
Created a new
$found_display
\n
";
$class
->
collection
()
->
add
(
$self
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment