Xray::BLA::Tools¶
NAME¶
Xray::BLA::Tools - A role with tools and conveniences for BLA
VERSION¶
See Xray::BLA
METHODS¶
file_template
Construct a file name from BLA object attributes using a simple %-sign substitution scheme:
%s : stub %e : emission energy %i : incident energy %t : tiffcounter %T : padded, 3-digit energy index %c : energy index counter %% : literal %As an example:
$bla->file_template('%s_elastic_%e_%t.tif')might evaluate to Aufoil1_elastic_9711_00001.tif.
Optional arguments:
$bla->file_template('%s_elastic_%e_%t.tif', {counter=>$n, re=>1})
counter
is used to increment a file name counter.re
indicates that the template should return a suitable regular expression for%e
and%c
.
howlong
Report on a time span in human readable terms.
my $start = DateTime->now( time_zone => 'floating' ); ## ## do stuff... ## print $spectrum->howlong($start, $text);The first argument is a DateTime object created at the beginning of a lengthy chore. The second argument is text that will be reported in the return string, as in "$text took NN seconds".
randomstring
Return a random string of a specified length, used to make temporary files and folders.
my $string = $spectrum->randomstring(6);The default is a 6-character string.
is_windows
, is_osx
Return true is the operating system is Windows or OSX. This is a simple heuristic based on$^O
(see http://perldoc.perl.org/perlvar.html);
LICENCE AND COPYRIGHT¶
Copyright (c) 2011-2014,2016 Bruce Ravel, Jeremy Kropf. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlgpl.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Xray::BLA and METIS are copyright © 2011-2014, 2016 Bruce Ravel and Jeremy Kropf – This document is copyright © 2016 Bruce Ravel
This document is licensed under The Creative Commons Attribution-ShareAlike License.
If this software and its documentation are useful to you, please consider supporting The Creative Commons.