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
Commits
0d3d61ba
Commit
0d3d61ba
authored
Jun 14, 2012
by
Andy Yates
Browse files
A more succient version of the method.
parent
09cb57ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
modules/Bio/EnsEMBL/Pipeline/Base.pm
modules/Bio/EnsEMBL/Pipeline/Base.pm
+9
-7
No files found.
modules/Bio/EnsEMBL/Pipeline/Base.pm
View file @
0d3d61ba
...
...
@@ -128,17 +128,19 @@ sub production_name {
return
$prod
;
}
# Closes file handle, and deletes the file stub if it contains no data
# Returns success type
# Closes file handle, and deletes the file stub if no data was written to
# the file handle (using tell). We can also only close a file handle and unlink
# the data if it was open otherwise we just ignore it
# Returns success if we managed to close/delete the file
sub
tidy_file_handle
{
my
(
$self
,
$fh
,
$path
)
=
@_
;
if
(
$fh
->
tell
()
==
0
)
{
$fh
->
close
()
if
$fh
->
opened
();
unlink
(
$path
)
if
-
f
$path
;
if
(
$fh
->
opened
())
{
my
$unlink
=
(
$fh
->
tell
()
==
0
)
?
1
:
0
;
$fh
->
close
();
unlink
(
$path
)
if
-
f
$path
&&
$unlink
;
return
1
;
}
$fh
->
close
()
if
$fh
->
opened
();
}
return
0
;
}
...
...
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