@ -125,7 +125,7 @@ sub add_commas
return ( $ number ) ;
return ( $ number ) ;
}
}
local ( $ _ ) = $ whole ? $ whole : "" ;
local ( $ _ ) = defined $ whole ? $ whole : "" ;
1 while s/^(-?\d+)(\d{3})/$1,$2/ ;
1 while s/^(-?\d+)(\d{3})/$1,$2/ ;
$ whole = $ _ ;
$ whole = $ _ ;
@ -249,53 +249,53 @@ sub bytes_to_human_readable
{
{
# Yebibyte
# Yebibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 80 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 80 ) ) ) ;
$ suffix = "YiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0030" } ) ;
}
}
elsif ( $ unit =~ /Z/i )
elsif ( $ unit =~ /Z/i )
{
{
# Zebibyte
# Zebibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 70 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 70 ) ) ) ;
$ suffix = "ZiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0029" } ) ;
}
}
elsif ( $ unit =~ /E/i )
elsif ( $ unit =~ /E/i )
{
{
# Exbibyte
# Exbibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 60 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 60 ) ) ) ;
$ suffix = "EiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0028" } ) ;
}
}
elsif ( $ unit =~ /P/i )
elsif ( $ unit =~ /P/i )
{
{
# Pebibyte
# Pebibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 50 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 50 ) ) ) ;
$ suffix = "PiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0027" } ) ;
}
}
elsif ( $ unit =~ /T/i )
elsif ( $ unit =~ /T/i )
{
{
# Tebibyte
# Tebibyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 40 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 40 ) ) ) ;
$ suffix = "TiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0026" } ) ;
}
}
elsif ( $ unit =~ /G/i )
elsif ( $ unit =~ /G/i )
{
{
# Gibibyte
# Gibibyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 30 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 30 ) ) ) ;
$ suffix = "GiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0025" } ) ;
}
}
elsif ( $ unit =~ /M/i )
elsif ( $ unit =~ /M/i )
{
{
# Mebibyte
# Mebibyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 20 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 20 ) ) ) ;
$ suffix = "MiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0024" } ) ;
}
}
elsif ( $ unit =~ /K/i )
elsif ( $ unit =~ /K/i )
{
{
# Kibibyte
# Kibibyte
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 2 ** 10 ) ) ) ;
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 2 ** 10 ) ) ) ;
$ suffix = "KiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0023" } ) ;
}
}
else
else
{
{
$ suffix = "B" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0014" } ) ;
}
}
}
}
else
else
@ -305,53 +305,53 @@ sub bytes_to_human_readable
{
{
# Yebibyte
# Yebibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 80 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 80 ) ) ) ;
$ suffix = "YiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0030" } ) ;
}
}
elsif ( $ human_readable_size >= ( 2 ** 70 ) )
elsif ( $ human_readable_size >= ( 2 ** 70 ) )
{
{
# Zebibyte
# Zebibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 70 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 70 ) ) ) ;
$ suffix = "ZiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0029" } ) ;
}
}
elsif ( $ human_readable_size >= ( 2 ** 60 ) )
elsif ( $ human_readable_size >= ( 2 ** 60 ) )
{
{
# Exbibyte
# Exbibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 60 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 60 ) ) ) ;
$ suffix = "EiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0028" } ) ;
}
}
elsif ( $ human_readable_size >= ( 2 ** 50 ) )
elsif ( $ human_readable_size >= ( 2 ** 50 ) )
{
{
# Pebibyte
# Pebibyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 50 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 2 ** 50 ) ) ) ;
$ suffix = "PiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0027" } ) ;
}
}
elsif ( $ human_readable_size >= ( 2 ** 40 ) )
elsif ( $ human_readable_size >= ( 2 ** 40 ) )
{
{
# Tebibyte
# Tebibyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 40 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 40 ) ) ) ;
$ suffix = "TiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0026" } ) ;
}
}
elsif ( $ human_readable_size >= ( 2 ** 30 ) )
elsif ( $ human_readable_size >= ( 2 ** 30 ) )
{
{
# Gibibyte
# Gibibyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 30 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 30 ) ) ) ;
$ suffix = "GiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0025" } ) ;
}
}
elsif ( $ human_readable_size >= ( 2 ** 20 ) )
elsif ( $ human_readable_size >= ( 2 ** 20 ) )
{
{
# Mebibyte
# Mebibyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 20 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 2 ** 20 ) ) ) ;
$ suffix = "MiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0024" } ) ;
}
}
elsif ( $ human_readable_size >= ( 2 ** 10 ) )
elsif ( $ human_readable_size >= ( 2 ** 10 ) )
{
{
# Kibibyte
# Kibibyte
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 2 ** 10 ) ) ) ;
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 2 ** 10 ) ) ) ;
$ suffix = "KiB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0023" } ) ;
}
}
else
else
{
{
$ suffix = "B" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0014" } ) ;
}
}
}
}
}
}
@ -365,53 +365,53 @@ sub bytes_to_human_readable
{
{
# Yottabyte
# Yottabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 24 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 24 ) ) ) ;
$ suffix = "YB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0022" } ) ;
}
}
elsif ( $ unit =~ /Z/i )
elsif ( $ unit =~ /Z/i )
{
{
# Zettabyte
# Zettabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 21 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 21 ) ) ) ;
$ suffix = "ZB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0021" } ) ;
}
}
elsif ( $ unit =~ /E/i )
elsif ( $ unit =~ /E/i )
{
{
# Exabyte
# Exabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 18 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 18 ) ) ) ;
$ suffix = "EB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0020" } ) ;
}
}
elsif ( $ unit =~ /P/i )
elsif ( $ unit =~ /P/i )
{
{
# Petabyte
# Petabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 15 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 15 ) ) ) ;
$ suffix = "PB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0019" } ) ;
}
}
elsif ( $ unit =~ /T/i )
elsif ( $ unit =~ /T/i )
{
{
# Terabyte
# Terabyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 12 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 12 ) ) ) ;
$ suffix = "TB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0018" } ) ;
}
}
elsif ( $ unit =~ /G/i )
elsif ( $ unit =~ /G/i )
{
{
# Gigabyte
# Gigabyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 9 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 9 ) ) ) ;
$ suffix = "GB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0017" } ) ;
}
}
elsif ( $ unit =~ /M/i )
elsif ( $ unit =~ /M/i )
{
{
# Megabyte
# Megabyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 6 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 6 ) ) ) ;
$ suffix = "MB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0016" } ) ;
}
}
elsif ( $ unit =~ /K/i )
elsif ( $ unit =~ /K/i )
{
{
# Kilobyte
# Kilobyte
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 10 ** 3 ) ) ) ;
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 10 ** 3 ) ) ) ;
$ suffix = "KB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0015" } ) ;
}
}
else
else
{
{
$ suffix = "b" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0014" } ) ;
}
}
}
}
else
else
@ -421,53 +421,54 @@ sub bytes_to_human_readable
{
{
# Yottabyte
# Yottabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 24 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 24 ) ) ) ;
$ suffix = "YB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0022" } ) ;
}
}
elsif ( $ human_readable_size >= ( 10 ** 21 ) )
elsif ( $ human_readable_size >= ( 10 ** 21 ) )
{
{
# Zettabyte
# Zettabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 21 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 21 ) ) ) ;
$ suffix = "ZB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0021" } ) ;
}
}
elsif ( $ human_readable_size >= ( 10 ** 18 ) )
elsif ( $ human_readable_size >= ( 10 ** 18 ) )
{
{
# Exabyte
# Exabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 18 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 18 ) ) ) ;
$ suffix = "EB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0020" } ) ;
}
}
elsif ( $ human_readable_size >= ( 10 ** 15 ) )
elsif ( $ human_readable_size >= ( 10 ** 15 ) )
{
{
# Petabyte
# Petabyte
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 15 ) ) ) ;
$ human_readable_size = sprintf ( "%.3f" , ( $ human_readable_size /= ( 10 ** 15 ) ) ) ;
$ suffix = "PB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0019" } ) ;
}
}
elsif ( $ human_readable_size >= ( 10 ** 12 ) )
elsif ( $ human_readable_size >= ( 10 ** 12 ) )
{
{
# Terabyte
# Terabyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 12 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 12 ) ) ) ;
$ suffix = "TB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0018" } ) ;
}
}
elsif ( $ human_readable_size >= ( 10 ** 9 ) )
elsif ( $ human_readable_size >= ( 10 ** 9 ) )
{
{
# Gigabyte
# Gigabyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 9 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 9 ) ) ) ;
$ suffix = "GB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0017" } ) ;
}
}
elsif ( $ human_readable_size >= ( 10 ** 6 ) )
elsif ( $ human_readable_size >= ( 10 ** 6 ) )
{
{
# Megabyte
# Megabyte
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 6 ) ) ) ;
$ human_readable_size = sprintf ( "%.2f" , ( $ human_readable_size /= ( 10 ** 6 ) ) ) ;
$ suffix = "MB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0016" } ) ;
}
}
elsif ( $ human_readable_size >= ( 10 ** 3 ) )
elsif ( $ human_readable_size >= ( 10 ** 3 ) )
{
{
# Kilobyte
# Kilobyte
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 10 ** 3 ) ) ) ;
$ human_readable_size = sprintf ( "%.1f" , ( $ human_readable_size /= ( 10 ** 3 ) ) ) ;
$ suffix = "KB" ;
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0015" } ) ;
}
}
else
else
{
{
$ suffix = "b" ;
# Bytes
$ suffix = $ anvil - > Words - > string ( { key = > "suffix_0014" } ) ;
}
}
}
}
}
}