App-Prefix
view release on metacpan or search on metacpan
}
# start from largest unit, a year, and work towards smaller units
if (abs($t) >= 86400 * 365.25) {
# this is not exact because we ignore leap years
return sprintf($format, $t/(86400 * 365.25)) . " years";
}
# Considered, but removed, months entries in seconds_for_display()
# 1) hard to abbreviate months in 4 chars. mnths?
# 2) 2.1 months looks especially weird
# 3) months are much more variable-sized than any other time unit
# therefore more ambiguous and complex to compute (Ie, 28 vs 31 days)
#my $seconds_per_month = (365.25 / 12) * 86400; # mythical equal-sized months
#if (abs($t) >= $seconds_per_month) {
# return sprintf($format, $t/$seconds_per_month) . " mnths";
#}
if (abs($t) >= 86400) {
return sprintf($format, $t/86400) . " days";
}
t/actualtest.t view on Meta::CPAN
my $perl = $^X;
# use catfile for win32 safety
my $prefix = catfile("bin", "prefix" );
my $one_word_file = catfile("t", "one_word.dat");
my $two_word_file = catfile("t", "two_words.dat");
my $sample_file = catfile("t", "sample.dat");
my @out = like_btick( $perl, $prefix, "-host", $sample_file );
cmp_ok( scalar(@out), '==', 5, "prefix: read t/sample.dat" );
cmp_ok( $out[0], '=~', '.* OK: System operational', "line from test file looks as expected" );
# set up command line stuff specifically for IPC::Run
my @tests = (
[ [$perl, $prefix, $one_word_file], 'sanguine$'], # no option, no change
[ [$perl, $prefix, "-host", $one_word_file], '.* sanguine$' ], # test -host
[ [$perl, $prefix, "-host", "-suffix", $one_word_file], 'sanguine .*' ], # test -suffix
[ [$perl, $prefix, "-version" ], 'prefix [0-9.]+$' ], # test -version
( run in 0.367 second using v1.01-cache-2.11-cpan-64827b87656 )